Problem 1982. Battleship - Seaman Level

Games Magazine Battleships is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.

The Seaman Level is the simplest and can be solved by direct evolution of current condition.

Map information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).

Ships have no diagonal or UDLR adjacency. The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.

The map is ringed by zeros to make m a 12x12 array.

Input: m,r,c; m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums

Output: b; A binary 12x12 array

Example:

r=[0 2 0 2 2 2 3 2 3 0 4 0]';
c=[0 4 0 3 1 3 1 4 0 1 3 0];
m              b
000000000000  000000000000
077757777770  000011000000
077777777770  000000000000
077777777770  000100010000
077777777770  000100010000
077777777770  010000010000
077777777770  010000010010
027777777760  010000000010
077777777770  000101000010
077777777770  000000000000
077777477770  010001100100
000000000000  000000000000

Future: The example is a Level-4 Captain board. The future holds less explicit boards that will require recursion methods.

Solution Stats

33.33% Correct | 66.67% Incorrect
Last Solution submitted on Dec 11, 2022

Solution Comments

Show comments

Problem Recent Solvers3

Suggested Problems

More from this Author294

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!