Battleships

A fleet is hidden in the grid: on the 10×10 board, one four-cell battleship, two cruisers, three destroyers and four submarines. Every ship is a straight run of cells, and no two ships touch — not even diagonally. The number beside a row or column counts the ship cells in it, and a few cells are revealed outright. What a revealed cell shows is the shape of the piece, not merely that something is there: water, a submarine, a rounded end that points, or a middle that does not say which way it runs. Click a cell to place a ship part, again for water, again to clear it.

the board

ship — part of some ship water — you have ruled it out proved — what the selected rung already knows revealed — printed on the board, never yours to change

The clause that does the work is the word “even”

Battleships prints two kinds of information: the fleet, and the numbers beside the rows and columns. Neither is the clause that makes the genre solvable. That one is buried in the sentence no two ships touch, not even diagonally, and it never appears on the board at all. It pays twice. Locally, because a ship is a straight run, the four diagonal neighbours of any ship cell can belong to no ship whatsoever — so writing down one ship cell hands you up to four water cells before you have done any arithmetic. Globally, it is the difference between a puzzle and a haystack.

board and fleetno two ships touch at allships may touch diagonallywhat the word “even” is worth
5×51,42831,19621.8×
6×6894,2966,801,5607.61×
7×752,038,088206,437,7163.97×
8×8946,204,4802,577,018,1602.72×
8×8 standard20,774,262,2841,302,617,200,96462.7×

On an 8×8 board carrying the standard armada, dropping that one word multiplies the answer space by 62.7× — from 20,774,262,284 placements to 1,302,617,200,964. The same board with the smaller six-ship fleet only gains 2.72×, which is the whole point: the clause is worth more the more crowded the ocean is, because what it really rations is space between ships, and a crowded fleet spends most of the board on that rationing.

How much ocean the armada has, to the last digit

An answer, before a single number is read, is a set of cells whose blocks are straight runs, one per ship, no two of them touching. src/count.ts counts those exactly with a row-at-a-time sweep, and the no-touch rule is what makes the rows cheap. A run of two or more cells inside one row is necessarily a finished horizontal ship — nothing may sit above or below it — so the only thing that can cross the line between two rows is a single cell carrying straight on, in the very same column. The whole frontier is therefore: which columns the row above used, how far each of its single-cell runs has already grown downwards, and which ships are still unplaced.

gridplacements of the standard armadafrontier statestime
4×4011 ms
5×5061 ms
6×603,25422 ms
7×7406,664123,454380 ms
8×820,774,262,284689,4302.6 s
9×915,624,844,160,8802,643,55016.1 s
10×101,855,545,978,831,7808,335,17471.4 s
11×1176,057,466,137,845,00424,536,651517.6 s

The standard armada is twenty cells of ship that may not touch, and the first square board it fits on at all is 7×7, in 406,664 ways. On the board the game is actually played on it has 1,855,545,978,831,780 places to hide, and one size further up the number is 76,057,466,137,845,004. Searching the OEIS in September 2026 for either sequence returns nothing.

Two rows of it are somebody else's sequence, though, which is what makes them a check rather than a claim. Shrink every ship to a single cell and let the fleet be unlimited, and a placement is just a set of cells no two of which touch — non-attacking kings. That is A063443, whose own headline reading is “tile an n×n square with 1×1 and 2×2 tiles” (a 2×2 tile's top-left corner is a king). Drop the diagonal clause as well and it becomes the independent sets of the grid graph, A006506. The sweep reproduces both, with no special-casing: the same code path, a different fleet.

gridships of one cell, unlimitedA063443…and without the diagonal clauseA006506
1×12agrees2agrees
2×25agrees7agrees
3×335agrees63agrees
4×4314agrees1,234agrees
5×56,427agrees55,447agrees
6×6202,841agrees5,598,861agrees
7×712,727,570agrees1,280,128,950agrees
8×81,355,115,601agrees660,647,962,955agrees
9×9269,718,819,131agrees

The fleet hides in the corners, and the blank board says so

The sweep carries forward weights, and a backward pass gives every frontier state the number of ways it can still be finished. Multiply the two and you get, exactly, the probability that any given cell holds a ship — averaged over the entire answer space rather than over a sample of it. The answer is not flat, and it is not close to flat.

boardcorner celledge cellcentre cellcorner ÷ centre
6×643.06%33.48%25.39%1.70×
8×853.66%42.09%21.42%2.50×
10×1023.63%24.52%18.25%1.29×

Over all 1,855,545,978,831,780 placements of the standard armada on the standard board, a cell on the border holds a ship about 24.52% of the time and a cell in the middle only 18.25% — the corner beats the centre by 1.29×. The reason is the clause again: a ship cell in the middle has to keep eight neighbours clear, a ship cell in a corner only three, so the border is the cheap real estate and that is where the fleet ends up. Squeeze the same twenty ships onto an 8×8 and the corner pulls further ahead of the centre — 2.50× — because crowding is exactly what the clause taxes.

The one place the ordering is not monotone is the corner itself at 10×10, where an edge cell (24.52%) just edges out the corner (23.63%). A corner is the cheapest cell to occupy but there are only four of them, and a ship reaching out of one immediately leaves the border; on a board with room to spare that costs more than the corner saves. At 6×6 and 8×8, where there is no room to spare, the corner wins outright — 43.06% against 33.48%, and 53.66% against 42.09%.

every placement, 10×10
the shipped bank, 10×10

The second grid is the 36 boards this page ships, and the honest reading of it is that 36 boards are not enough to read anything from. The largest per-cell gap against the exact probabilities is 16.0%, and the one-sigma sampling noise for a bank this size is already 7.3% per cell — so the gap is what a fair draw of 36 would look like anyway. There may well be a selection effect in there: the generator's answers are uniform, but only the answers that turn out to be solvable get shipped, and nothing guarantees that filter is neutral. This bank cannot show it. What the left-hand grid does show is not a sample at all — it is the whole space, and the border really is brighter than the middle.

boarddraws from the samplerworst per-cell gap against the exact marginals
6×6200,0000.215%
8×8100,0000.498%
10×1020,0000.753%

That the sampler is uniform is not an assumption either. It draws by walking the same frontier forwards with each row weighted by how many finished placements it leaves reachable — no rejection, no retries — and over 20,000 draws at 10×10 no cell is off its exact probability by more than 0.753%.

The numbers are the weakest thing on the board

A 6×6 board carries a fleet of 3, 2, 2, 1, 1, 1 and its whole answer space is 894,296 placements, which fits in memory. So the twelve printed numbers can be priced exactly: group every placement by the row and column counts it produces, and look at the groups.

the whole 6×6 answer space
placements894,296
distinct sets of twelve numbers254,877
placements the numbers alone pin down73,536 (8.22%)
answers left, for a typical placement (median)5
answers left, at worst36

Every number on the board, and a typical 6×6 still has 5 answers left; only 8.22% of placements are pinned down by arithmetic alone. That is the genre's real shape: the numbers are a filter, not a solution, and everything that closes the gap comes from the revealed pieces and from the no-touch rule.

Not every number is worth the same. Group the whole space by what one line prints and the shares fall out exactly — and they say something slightly against intuition:

a line that printshow much of the 6×6 answer space it leaves
017.38%
130.17%
227.98%
317.99%
45.83%
50.65%

The sharpest number is the biggest one: a line printing 5 leaves only 0.65% of the space, because a line that crowded is rare. A 0 leaves 17.38% — much blunter as a filter. But a 0 is the only value that settles its entire line on sight, with no other information, and that is the difference between information and usable information. The number that cuts the space hardest is not the number you can act on.

The same measurement at the sizes too large to enumerate, over uniform draws instead of the whole space:

boarddrawscells the numbers alone settle (median)boards the numbers alone finishanswers left (median, capped at 12)
6×630033.3%9.0%5
8×820023.4%0.5%12
10×1012028.0%0.0%12

A revealed piece says more than “a ship is here”

The pieces Bimaru prints are not counters. A revealed cell shows water, a submarine, a rounded end that points one way, or an unoriented middle — and each of those is a statement about the cells next to it. A submarine is four water cells in disguise. A pointing end is three water cells and one ship cell. Only the middle keeps a secret, and it keeps exactly one bit of it: which axis it runs along.

That is measurable. Take a uniform answer, reveal every cell, then rub reveals out in a random order for as long as the board still has exactly one answer. Do it twice: once with the pieces Bimaru prints, once with a weakened dialect where a ship cell only admits to being a ship.

boarddrawsreveals needed, as shapes (median)reveals needed, occupancy only (median)what the shape is worth
6×61202 (mean 1.54)2 (mean 1.83)1.19×
8×8602 (mean 2.60)3 (mean 3.35)1.29×
10×10245 (mean 4.67)5 (mean 5.88)1.26×

At 10×10 a minimal board needs 4.67 printed pieces on average; strip the shapes and the same answers need 5.88 — 1.26× as many cells to say the same thing. That is a real premium, and it is also smaller than it sounds. A shape hint looks like it should be worth four or five cells, because it names its whole neighbourhood; it is worth about a quarter of a cell extra, because the no-touch clause was going to tell you most of that neighbourhood anyway. The unprinted clause is not only the strongest thing on the board, it is strong enough to make the printed pieces partly redundant.

The ladder

rung6×6 cells settled6×6 finished8×8 cells settled8×8 finished10×10 cells settled10×10 finished
count76.2%9/3648.9%0/3658.8%0/36
touch89.7%20/3681.0%6/3680.5%2/36
line90.3%20/3683.8%7/3680.6%2/36
fleet100.0%36/36100.0%36/36100.0%36/36
probe100.0%36/36100.0%36/36100.0%36/36

Every shipped board is finished by the fleet rung, by construction — the generator kept rubbing reveals out only for as long as propagation could still close the board without guessing. What the table shows is the shape of the climb. At 10×10 the numbers alone settle 58.8% of the grid and finish 0 boards; adding the unprinted no-touch clause takes it to 80.5%; reading the lines as nonogram lines takes it to 80.6% and finishes 2; the inventory closes the rest.

The same rungs, priced as pruning instead of as proof

Run the complete search, but only let it propagate up to a given rung between branch points, and count the branch points. The ceiling is 200,000.

propagation allowed6×6 branch points (median)6×6 worst8×8 branch points (median)8×8 worst
up to count46780519,613
up to touch010324
up to line010322
up to fleet0000

The interesting part is the ordering. In the answer-space table the no-touch clause is worth tens of times over; here, as a pruning rule, touch takes an 8×8 from 805 to a median of 3 branch points, and the fleet rung finishes the job at 0. A clause can be cheap in one accounting and decisive in the other, and there is no way to know which without running both.

The shipped boards

boardboardscells revealed (median)fewestmostof them water (median)
6×6362040
8×8364271
10×103662112

Every reveal on these boards is load-bearing: they were built by revealing the whole grid and rubbing cells out in a random order for as long as the ladder could still finish without guessing, so removing any one of the survivors breaks the board. The tests re-derive that rather than trusting it.

Three ways to misread the board

misreadingboardintended answer still legalanswers (median, capped at 12)still unique
ships may touch diagonally6×636/36127/36
the fleet is not fixed6×636/36120/36
a reveal only says a ship is there6×636/36218/36
ships may touch diagonally8×836/36218/36
the fleet is not fixed8×836/36213/36
a reveal only says a ship is there8×836/3648/36

All three misreadings are generous — each one only ever adds answers, so the intended answer stays legal on every board and nothing looks wrong until the end. Forgetting the word “even” leaves 18 of 36 8×8 boards unique; reading the printed pieces as mere counters leaves 8 of 36. A player who makes either mistake does not get stuck — they get a board with several answers and no way to tell which one was meant, which is the failure mode worth guarding against.