Plainwork

Plainwork / Shoal / How to solve battleship puzzles (Bimaru)

How to solve battleship puzzles (Bimaru): the techniques that finish every board

Battleship solitaire, also called Bimaru or Yubotu, hides a small fleet in a grid. The numbers beside the grid say how many ship cells each row and column holds, ships are straight, and no two ships touch, not even diagonally. Every well-made board can be solved by logic alone. Here are the techniques in the order to try them, with a real 6 by 6 board.

The rules in one paragraph

You are given a fleet (for a 6 by 6 board here: one ship three cells long, two of length two, three of length one), the row and column totals, and a few cells that are already filled in as ship or water. Place every ship so the totals match. Ships are single cells or straight lines. They never share a side or a corner with another ship. That one rule, "water all around", does most of the work.

1. Zeros and water around ships

Any row or column marked 0 is all water. Every cell that touches a ship at a corner is water, because ships cannot touch. If a ship cell has a ship cell beside it on the left or right, the ship runs sideways, so the cells above and below it are water (and the same for up and down). Once a ship has reached its full length, the cells at both ends are water too.

2. Count full, count forced

When a row or column already holds as many ship cells as its number, everything else in it is water. The opposite also works: when the number of cells still undecided in a row or column is exactly the number of ship cells it still needs, every one of them is a ship.

3. Hunt the longest ship

The longest ship has the fewest places to go. Look for rows or columns whose number is large enough, whose cells are not blocked by water, and ask where a line that long could fit. Often there is only one place, and you can put the whole ship down. Then do the same for the next longest.

4. Fleet accounting

Keep the list of ships beside the grid. Once every ship of one length is placed, no other group may be that long, so any undecided cell that would make one is water. A group can never grow longer than the longest ship in the fleet. Shoal ticks each ship off for you as you place it.

5. The what-if step (hardest boards only)

When nothing is forced, pick one undecided cell and pretend it is a ship. Apply techniques 1 to 4 and see whether a row or column breaks (too many ships, too few places left, or a ship that is too long or the wrong count). If it does, the cell is water. If pretending it is water breaks something, the cell is a ship. Shoal's Monday to Thursday boards need at most one what-if at a time. The Friday to Sunday boards can need a what-if inside a what-if, which is why they are the hard days (the Hint button is there for them).

A worked example

This is a real board from Shoal's practice set. Row numbers are on the left (1, 1, 4, 1, 2, 1) and column numbers on top (1, 3, 1, 2, 0, 3). A filled square is a given ship cell and a dot is given water. The board has one given ship (row 3, column 3) and two given water cells (row 2 column 4, row 6 column 3).

131203
1
1 ·
4 ■
1
2
1 ·

Below, each step names the technique it uses (the numbers are the technique headings above). Cells are written as row and column, so R3C6 is row 3, column 6.

  1. Zeros (1). Column 5 says 0, so the whole column is water.
  2. Water around ships (1). The given ship at R3C3 touches four corners, so R2C2, R2C4, R4C2 and R4C4 are water.
  3. Count full (2). Column 3 says 1 and already holds R3C3, so every other cell in column 3 is water.
  4. Fleet accounting (4). Row 3 needs 4 ship cells, and column 5 is water. If R3C6 were water, the four cells would have to be columns 1 to 4 in a row, a ship of length 4, and this fleet has no such ship. So R3C6 is a ship.
  5. What-if (5), then count (2). Rows 2 and 4 each need one ship and can only get it from column 1 or column 6 (everything else in those rows is water). Suppose R2C6 were water. Then R2C1 is row 2's ship, which fills column 1 (it needs only 1), so R3C1 is water. Row 3 would then need columns 2, 3, 4 and 6, but R3C2 touches R2C1 at a corner. That breaks the rules, so R2C6 is a ship. The same argument with row 4 shows R4C6 is a ship.
  6. Count full (2), then fleet accounting (4). Column 6 now holds R2C6, R3C6 and R4C6, which is the 3 it needs, so R1C6, R5C6 and R6C6 are water, and those three cells are the one ship of length 3. The fleet has no second one.
  7. Fleet accounting (4). Row 3 still needs two more ship cells from columns 1, 2 and 4. Columns 1 and 2 together with R3C3 would make a run of 3, columns 2 and 4 with R3C3 as well, and the length-3 ship is already used. So row 3 takes columns 1 and 4: R3C1 and R3C4 are ships and R3C2 is water. R3C3 and R3C4 form a ship of length 2, and R3C1 is a ship of length 1.
  8. Count full (2). R3C1 fills column 1, so every other cell in column 1 is water.
  9. Count forced (2). Row 5 needs 2 ship cells, and the only cells it has left are R5C2 and R5C4, so both are ships. R5C4 gives column 4 its second ship, so R1C4 and R6C4 are water.
  10. Count forced (2). Column 2 needs 3 ship cells and has only R1C2, R5C2 and R6C2 left (R2C2, R3C2 and R4C2 are water), so all three are ships. R5C2 and R6C2 make the second ship of length 2, and R1C2 and R5C4 are the last two single ships.

Every ship in the fleet is now placed (one of length 3, two of length 2, three of length 1) and every row and column adds up. The finished board is below.

131203
1·■····
1·····■
4■·■■·■
1·····■
2·■·■··
1·■····

Every board in Shoal is generated this way and then checked twice: one program searches for solutions and must find exactly one, a second, independently written program must agree, and a third program that only uses the techniques above (including at most two nested what-ifs) must be able to finish it. If you ever find a Shoal board that has a second answer or needs a guess, tell us at [email protected].

Try it

Play today's free Shoal puzzle, or type any board you are stuck on into the battleship solitaire solver, which counts solutions, solves it and explains one forced move at a time.

Prefer paper? There are three free printable battleship solitaire puzzles with an answer key.

More from the catalogue

Other small tools

See everything →