Plainwork

Plainwork / 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 ·

Step 1. Column 5 says 0, so the whole column is water. Step 2. The given ship in row 3 column 3 touches four corners, so those four cells are water. Step 3. Row 3 needs 4 ship cells but column 5 is water, so they come from columns 1, 2, 3, 4 and 6, and column 3 is one of them. If column 6 were left out, the four ship cells would be columns 1 to 4 in a row, a ship of length four, and there is no such ship in this fleet. So row 3, column 6 is a ship. The rest of the board follows from the same moves: water around the ships, counting full rows and columns, fleet accounting and, once or twice, a what-if. 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.

More from the catalogue

Other small tools

See everything →