What is Dots and Boxes?
Dots and Boxes is a pencil game on a grid of dots where two players take turns joining two neighbouring dots with a line, and whoever completes the fourth side of a box claims it. Claiming a box earns another turn, and when every line is drawn the player with more boxes wins.
It began as a game played in the corner of a school notebook and is also known as the dot game, boxes, squares or pigs in a pen. The French mathematician Édouard Lucas published it in 1889, and it has been a classic ever since. The rules fit in two lines, but the endgame hides a deep theory of chains and double-crosses that mathematicians have written an entire book about.
What exactly are the rules?
There are three. One line per turn, closing the fourth side makes the box yours, and claiming a box means you move again. If one line closes the boxes on both of its sides, you take both.
| Situation | What happens |
|---|---|
| You draw a line and no box closes | The turn passes to the other player |
| You draw the fourth side of a box | Your stamp goes in the box and you draw again |
| One line closes the box on each side | Both boxes are yours, and you still draw again |
| You claimed a box but every line left is bad | You must still draw one. There is no passing |
| Every line is drawn | More boxes wins, equal boxes is a draw |
The 3×3 board has 16 dots and 24 lines, 5×5 has 36 dots and 60 lines, and 7×7 has 64 dots and 112 lines. All three have an odd number of boxes, so a draw is impossible.
Why should I never draw the third side?
Because once a box has three sides, the opponent draws the fourth, takes the box and moves again. That is why the opening is spent drawing only safe lines, where nobody gives a box away.
A safe line is one that does not bring any box to three sides. As the board fills up, safe lines run out, and eventually somebody has to draw a third side and hand over boxes. That moment is where the real game begins. The Normal computer knows this rule; the Easy computer sometimes forgets.
What is a chain?
A chain is a run of boxes that each have exactly two sides drawn, linked together. Draw one line at the end of a chain and the opponent can take every box in it, one after another, in a single turn.
| Shape | Character | If you open it |
|---|---|---|
| Short chain (1 or 2 boxes) | A small loss | The opponent takes 1 or 2 boxes and must open the next chain |
| Long chain (3 or more) | The heart of the endgame | The opponent takes it all, or leaves 2 boxes and keeps control |
| Loop (boxes joined in a ring) | No ends | The opponent takes it all, or leaves 4 boxes and keeps control |
When the safe lines are gone, the remaining boxes split into a few chains and loops. The winner is the player who gives away the short chains and makes the opponent open the long ones. Whether the number of long chains is odd or even decides who has to open first, which is why strong players start counting long chains in the middle of the game.
What is the double-cross?
The double-cross is declining the last two boxes of a long chain the opponent opened for you, and drawing a different line instead so that the opponent takes those two boxes with one line and then has to open the next chain. You give up two boxes to win every long chain that remains.
| The opponent opens a 5 box chain | You get | And then |
|---|---|---|
| Take all 5 | +5 | You must open the next chain and the opponent eats it whole |
| Take 3, leave 2 (double-cross) | +3, opponent +2 | The opponent must open the next chain and you eat it whole |
If only one long chain is left, take everything. If two or more remain, the double-cross is almost always right. The Hard computer counts every remaining chain and loop, scores both paths and picks the better one. When you have to give away a 2 box chain, draw its middle line, not the end: the opponent then cannot double-cross and simply has to take both and open the next.
How do the three computer levels differ?
Easy draws any safe line, Normal always closes a box it can and avoids third sides, and Hard counts chains and loops and plays the double-cross.
| Level | Opening | Endgame |
|---|---|---|
| Easy | Random safe lines | Sometimes misses a box and opens long chains without a care |
| Normal | Random safe lines | Takes every box it can and opens the smallest group when forced |
| Hard | Reads to the end once fewer than 12 safe lines remain | Searches the chain and loop structure, double-crosses and uses the hard-hearted handout |
In test matches the Hard computer beat the Normal computer in 98 of 100 games on the 5×5 board. To beat it you will have to count chains too.
Any tips for winning?
- Never draw a third side. Almost every early mistake is this one. Hover to see the gap, count the sides of the boxes on both sides, then draw.
- Count the safe lines left. If an odd number remain, the player to move draws the last safe line and the opponent has to open first.
- Fix the number of long chains. Split or join chains in the middle game so that the opponent is the one fated to open a long chain.
- Open short chains in the middle. The middle line of a 2 box chain denies the double-cross; the opponent just takes both.
- Leave two when you receive a long chain. If more long chains remain, the double-cross almost always pays.
Controls
- Phone and mouse: tap the empty gap between two dots to draw a line. With a mouse the gap under the pointer shows as a grey dotted line. Right next to a dot it is ambiguous whether you mean across or down, so tap the middle of the gap.
- Keyboard: arrow keys move between gaps and Enter or Space draws. The chosen gap shows as a dotted line in your colour. M or Esc returns to the menu.
- Two players: Blue and Red alternate on one screen. A yellow highlighter marks whose turn it is.
Board size, last mode, sound setting and your wins against each computer level are stored in this browser only and never sent to a server.