You played it as a child by taking every box you could reach. That is exactly how you lose. The winning move is to give boxes away — all but two of them — on purpose.
Two players, a grid of dots. You take turns drawing one short line between two neighbouring dots. Draw the fourth side of a little square and you've won that box — colour it in, score a point, and go again. When every line is drawn, whoever owns the most boxes wins. That's the whole game, and almost everyone learns it by the age of seven.
Almost everyone also learns it wrong. The instinct is to grab: take every box you can reach, every turn. But that instinct is the trap. The real game isn't about boxes at all. It's about chains — and about who is forced to open them.
Play long enough and the board "fills up": a moment arrives when every remaining line you could draw hands your opponent a free box. The safe moves run out. From here, the empty spaces have organised themselves into chains — corridors of boxes joined end to end — and somebody has to be the first to draw into one.
Whoever draws first into a chain gives the whole chain away. Watch it happen: you draw one line into a corridor of five boxes; your opponent completes that box, which hands them the next, which hands them the next, all five, like dominoes. A single open chain belongs entirely to the player who did not open it. The verifier confirms this with no hand-waving: a lone open chain of any length N is worth exactly −N to the player forced to move — they lose every box in it.
So the game is really a game of hot potato. You don't want boxes; you want to not be the one who has to open the next chain. The technical word is control, and there's a move that buys it.
Here is the move that the seven-year-old never finds. Your opponent has just opened a long chain and is handing it to you. You start eating boxes down the corridor — but you stop two short. Instead of taking the last two, you draw the line that closes off the far end, completing nothing and leaving a little 2-box domino sitting there for your opponent.
They're forced to take those two boxes — and then, with no safe move left, they're forced to open the next chain and hand it to you. You sacrificed two boxes to keep them in the role of the opener. This is the double-cross (Berlekamp's "all but two"), and it is the engine of expert play.
The arithmetic is exact and the verifier nails it. With k long chains of length L on the table, the player in control — double-crossing every chain but the last, then sweeping the final one whole — wins by
k·L − 4(k−1)
Two chains of four? Control wins by 4. Three chains of three? Control wins by 1. And the clincher: if neither player knew the trick — if both just greedily ate every chain whole — two equal long chains come out a dead tie. The double-cross is the entire difference between a draw and a win. Everything you give up, you give up to make the other player move first.
Not every region is a corridor. Sometimes the boxes close into a loop — a ring with no ends. Loops are governed by the same idea with a harsher tariff: to keep control of a loop you must hand back four boxes, not two, because a loop has to be left open at two places at once.
The contrast is exact. Two chains of four: control wins by 4. Two loops of four: a tie — the four-box sacrifice eats the whole margin. This is why a careful player tries to carve the board into long chains and pushes the loops onto the opponent.
All of this hangs on one question: when the safe moves finally run out, which player is stuck opening the first chain? Control is everything, and it's decided long before the endgame, in a quiet fight nobody at the kitchen table knows they're having.
The rule of thumb the experts use is the long-chain rule: count the dots on the board; to seize control, the first player wants the number of long chains to come out different in parity from the dots, and the second player wants them the same. (On the standard tournament board — 5×5 boxes, 36 dots — the first player is angling for an odd number of long chains.) It's a real and useful heuristic, and it's exactly the lever a clever human can pull against the opponent here, which plays safe moves in the opening without fighting for chain parity. Steer the board toward the parity that makes the computer open first, and the double-cross becomes yours.
The long-chain rule is a heuristic, not a theorem — it assumes the endgame will be all long chains, and the battle to force that structure is the genuinely hard, unsolved-in-general part of the game. What is a theorem, and sits under everything above, is the endgame arithmetic — the chain and loop values — which is forced once the structure is fixed, and which is recomputed exactly below.
Small boards can be solved outright — every line of play searched to the end. The answers are not the ones the kitchen table expects. The empty 2×2 board (nine dots) is a first-player win by two. Grow it by one box each way to 3×3 (sixteen dots) and it flips: now the second player wins, by three, no matter what the first player tries — a result confirmed by exhaustive computer search (Barker & Korf), and reproduced here from scratch over all 16,777,215 positions. The winner seesaws with the size of the board in a way no simple formula captures; this is a game that is genuinely, provably hard.
The opponent you just played uses exactly this fact. In the opening it plays a quick safe-move heuristic — never voluntarily giving you a box. But the moment the position is small enough to solve to the end, it switches to exact, perfect play. That's when it will double-cross you: the sacrifice you watched it make wasn't a trick I scripted, it was the provably optimal move, computed live in your browser. Beat it and you've genuinely out-thought a perfect endgame.
| board (boxes) | dots | perfect-play result | value |
|---|---|---|---|
| 1 × 1 | 4 | second player wins | −1 |
| 1 × 2 | 6 | drawn | 0 |
| 1 × 3 | 8 | second player wins | −1 |
| 2 × 2 | 9 | FIRST player wins | +2 |
| 2 × 3 | 12 | second player wins | −2 |
| 2 × 4 | 15 | first player wins | +2 |
| 3 × 3 | 16 | second player wins | −3 |
Value is the net box margin to the first player under perfect play — positive means the opener wins, negative means the second player wins. Every row is a full minimax over the real edge graph with the true "complete-a-box-move-again" rule; no heuristic stands in for a proof. The endgame laws are checked the same way: a lone chain of N is worth −N to the opener; k chains of L give the controller k·L − 4(k−1); two equal chains are a tie under greedy play and a win with the double-cross; two loops of four are a tie where two chains of four are a controller win by four.
Reproduce it: node research/dots-and-boxes/verify.mjs (30/30, fast checks plus the full 3×3 solve under --full). The opponent's endgame brain is the same exact search, compiled into this page.
• Elwyn R. Berlekamp, The Dots-and-Boxes Game: Sophisticated Child's Play (A K Peters, 2000) — the chains, loops, and the "all but two" double-cross.
• Berlekamp, Conway & Guy, Winning Ways for Your Mathematical Plays, vol. 3 — "Dots-and-Boxes" and the long-chain rule.
• Joseph K. Barker & Richard E. Korf, "Solving Dots-And-Boxes," AAAI 2012 — exhaustive solution confirming the 3×3 second-player win by three. [pdf]
• Daniel Allcock, "Best play in Dots and Boxes endgames" (2018), arXiv:1811.10747 — rigorous endgame theory.
• All numerical claims recomputed here: research/dots-and-boxes/verify.mjs and solve.mjs.