Observation · probability · strategy
Battleship
A hit gives you new information. Follow how it changes your search, from coordinates and targeting to exact probabilities and strategy experiments.
Theory
Use arrows to choose a cell and Enter or Space to press it. Ctrl/⌘ + Z undoes a change in the active example.
From rules to probability
01
First, name the cell
Each player has two grids: their own ships and their shots at the opponent. A letter names the column; a number names the row. B3 is the second column in the third row. Both players can identify a shot while the other fleet stays hidden.
Find B3. Then try any other cell.
Read the letter at the top and the number on the left. During a game, you shoot at a cell; you do not move the opponent's ships.
02
Straight ships, two rule sets
A ship fills consecutive cells horizontally or vertically. It cannot bend or cross an edge. Ships may touch but can never overlap: these are the default rules here. You can also choose a no-touch variant, which requires space between ships, even diagonally.
The dark ship is already placed. Tap the start of the second ship, rotate it and compare the touching rules.
This teaching fleet has two length-two ships. A full game has five ships of lengths 5–4–3–3–2, with no one-cell ships. Changing the touching rule does not change the fleet.
03
Miss, hit, sunk
A miss tells you that a cell is water. A hit reveals one ship segment. Sunk means every segment of that ship has been hit; this game also reports its length. By default players alternate shots, whatever the result. In the optional variant, a hit grants another shot. Sinking the last ship ends the game immediately.
These teaching ships are visible. Shoot at water and at ships: the result and next player appear beside the grid.
Two adjacent hits do not necessarily identify one sunk ship. You need the sunk response, not a guess based on the length of a line.
Dot: miss; cross: hit; outlined cross: the last shot that sank a ship.
04
Search widely, then follow a hit
Before a hit, search across the grid. After a hit, check the cells to its sides: ships are straight. Here there is one length-three ship and two known hits in the same row. It must be horizontal. Its remaining segment can be to the left or right; a distant random shot cannot finish it.
Choose an end of the line. A miss at one end leaves only the other possibility.
This deduction concerns one known ship. When touching is allowed, adjacent hits can belong to different ships; do not automatically combine them.
05
When the water around a ship is certain
A length-two ship has been sunk at the top. If ships cannot touch, every neighbouring cell around it is water, so no shots are needed there. If touching is allowed, another ship may be beside it. This knowledge comes from the rules, not from the colour of a marker.
Compare no touching with touching allowed. Tap a cell beside the sunk ship.
This teaching fleet has two length-two ships. No touching starts enabled for this comparison. Percentages count all complete legal fleets consistent with the two shots.
06
Adjacent hits can belong to different ships
There are two length-three ships, and touching is allowed. A1 and B1 both returned hit. In one legal fleet they belong to one horizontal ship. In another they belong to two vertical ships. Both fleets give the same replies to the shots so far. Those hits alone cannot determine an orientation.
Compare the two revealed possibilities. Shoot at C1 in each: the new reply distinguishes them.
The revealed fleet is a teaching hypothesis, not information available to the player. In an ordinary game the enemy fleet stays hidden.
07
Why checkerboard search works
Any two neighbouring cells have different checkerboard colours. Every straight ship at least two cells long must therefore cross the chosen colour. Every ship in our fleet meets that condition. You can search on that colour, then drop the restriction while following a hit.
Move and rotate the ship. Compare lengths two and three: the ship always crosses the highlighted colour.
The guarantee is to find at least one segment of each sufficiently long ship, not to sink the fleet in half the shots.
Outlined cells mark one checkerboard colour.
08
See probability as counting
There is one length-three ship. List all horizontal and vertical placements and give each the same probability. For a selected cell, keep only the placements containing it. Their share is the hit probability under this model. Central cells occur in more placements than corner cells.
Tap a corner, then a cell nearer the centre. Compare their fractions and the placements behind them.
We assigned equal chances to ship placements. That is an assumption, not a promise about how a person hides a fleet.
09
Evidence changes what is possible
On this tiny grid, a length-two ship has four placements. After a miss, discard placements with a ship in that cell. After a hit, discard placements without one. Count the share among the survivors. This is conditional probability: a chance updated using the known result, not a second independent coin toss.
Choose Miss or Hit, then tap a cell. This changes one observation; it does not play a game.
A miss at A1 leaves two placements. B2 contains a ship in both: 2 out of 2. The other segment is still uncertain.
10
Two ships form one complete fleet
With several ships, their positions depend on each other. An occupied cell is unavailable to another ship, and a no-touch rule excludes neighbours too. The first grid counts complete compatible fleets of two length-two ships. The second simply adds possible placements of each ship separately. That score can guide a shot, but it is not an exact full-fleet probability.
Tap a cell and compare the exact fraction with the score. Change the touching rule to see which complete fleets disappear.
The exact count includes each complete fleet once. Independent placements are not labelled a Bayesian probability, and this tiny enumeration is not claimed for a 10 × 10 game.
Complete fleets · exact fraction
Separate ships · score
11
Hitting and learning are different goals
After a miss at A1, two equally likely ship placements remain. B2 is a guaranteed hit, but it cannot distinguish them: both give the same answer. B1 can hit or miss; either response identifies the remaining placement. The best immediate hit chance and the most informative shot can therefore favour different cells.
Tap B2 and B1. Below the grid, see how possible responses split the remaining placements.
One bit here means distinguishing two equally likely alternatives. Zero bits means the reply removes no uncertainty. Neither objective by itself computes the fastest way to sink an entire fleet.
What do bits mean?
Here feedback is truthful and determined by the hidden fleet. The expected reduction in uncertainty equals the entropy of the possible replies: one certain reply gives 0 bits; two equally likely replies give 1 bit. Every possible reply is counted, including sunk, rather than only hit and miss.
Hit probability · 0–100%
12
Another Battleship: rebuild a fleet from clues
This is a separate puzzle with no opponent or shots. You know the fleet and the number of occupied cells in every row and column. Zero means the entire row or column is water. Mark ship segments so that all counts match, the ships are straight and they do not touch. One matching total does not prove that the whole fleet is correct.
Build two length-two ships. Numbers beside the grid show how many cells must be occupied. Tap a cell again to remove it, then check the complete fleet.
Start with zero rows and columns: no segment can go there. The remaining totals constrain where the length-two ship can fit.
13
One lucky game does not establish a strategy
Compare random search, following hits and placement scoring on the same fleets. Count each policy's own shots until every ship is sunk, not time or win percentage. The mean describes this series; the spread shows how individual games differ. Another fleet, rule set or placement method can change the result.
Run a small matched series. Then open the laboratory to edit evidence and compare strategies in more detail.
This is a reproducible teaching experiment on a 4 × 4 grid with two non-touching length-two ships. Its numbers do not predict a full 10 × 10 game.
Sources and limits
These examples and illustrations were created for this section. External studies inform the methods; their results do not replace our calculations.