Dots and Boxes: play here, then learn the chain trick
The pencil-and-paper game where you join dots, close boxes and try not to hand your opponent a long run of them. Play it below against the computer (easy, normal or hard) or with a friend on the same phone, on boards from 3 by 3 to 6 by 6 boxes. A chain counter beside the board shows the long chain rule working on your own game.
Play Dots and Boxes
Arrow keys move between lines. Enter or Space draws the line in focus.
Chain counter
Game log
Settings: opponent, board, computer level
The rules in 30 seconds
- Draw a grid of dots. Two players take turns.
- On your turn, join two dots next to each other, across or down (never diagonally), with one line.
- If your line closes the fourth side of a box, write your initial in it and draw another line. Keep going as long as you close boxes.
- When every line is drawn, count the boxes. Most boxes wins; on an even board a tie is possible.
How to play
Setting up
Any grid of dots works. Four rows of four dots make a 3 by 3 board of nine boxes, which fits a napkin and plays in a couple of minutes. Our game counts boards in boxes, so "5 by 5" means 25 boxes and 36 dots.
A turn
Join two dots that sit side by side or one above the other. Each line fills one gap, and a gap can only be filled once. If your line is the fourth side of a box, the box is yours: mark it with your initial and draw again. One line can finish two boxes at once if it is the last side of both.
Ending and scoring
The game ends when every gap has a line. Each box is a point. On a board with an odd number of boxes, such as 3 by 3 or 5 by 5, there is always a winner. On 4 by 4 or 6 by 6 a tie can happen.
How a game unfolds
Early on, both players draw lines that do not give the other a box. Sooner or later every line left would add a third side to some box, and the board has broken into chains: runs of boxes where one line opens them all to the other player. From then on, whoever has to open a chain usually hands over boxes, and the fight is about who has to open the long ones.
The long chain rule, worked through
A chain of three or more boxes is a long chain. A closed ring of boxes is a loop. When someone opens a long chain, the other player can take all of it, or take all but the last two and give those two away with one line at the far end (the sketch above). The player who gives two away keeps control: the opponent takes the pair with one stroke, a double-cross, and then has to open the next chain.
Why the dots matter
Schmitt's talk, based on Berlekamp's book The Dots-and-Boxes Game, proves a neat count: every game lasts exactly as many turns as there are dots plus the number of double-crosses. The first player has the odd turns, so they take the last turn when that total is odd. Usually there is one double-cross fewer than there are long chains, which turns into the rule:
Long chain rule: the first player wants dots + long chains to be even; the second player wants it odd.
Our tests play 150 random games on six board setups and check the turn count in every one: it always equals dots plus double-crosses. For each board in the game:
| Board (boxes) | Dots | First player wants | Second player wants |
|---|---|---|---|
| 3 by 3 (9 boxes) | 16 | an even number of long chains | an odd number |
| 4 by 4 (16 boxes) | 25 | an odd number of long chains | an even number |
| 5 by 5 (25 boxes) | 36 | an even number of long chains | an odd number |
| 6 by 6 (36 boxes) | 49 | an odd number of long chains | an even number |
When to keep control and when to grab everything
Keeping control costs 2 boxes per chain and 4 per loop, because a loop has to be given back as two pairs. Allcock's paper turns this into a test: keep control only if what is left on the board is worth more than 2 (for a chain) or 4 (for a loop) to whoever controls it. Some cases our module works out:
- Two chains of 3. The controller takes 1, gives 2, then gets all 3 of the last chain: 4 to 2. The ending is worth 2 to the controller, the same figure Allcock gives.
- A chain of 3 and one single box. The single box is worth only 1, so take all three and give up the box: you finish 3 to 1 instead of 2 to 2.
- Lots of 3-chains. With five of them the controller wins the ending by only 1; with six, by 2. Short chains make control cheap to lose, which is why, Allcock notes, an expert who expects to lose the chain count steers toward many 3-chains and small loops.
- A 6-loop opened, with another 6-loop and two 6-chains left. What is left is worth 6, more than 4, so take 2 of the loop boxes and hand over the other 4. Normal and Hard both do this; you can test them.
The chain counter next to the board reads your actual game: the dots, who wants even or odd, the long chains and loops already formed, and which player the count favors if no more form.
Where sources differ
- How boards are named. Wikipedia counts boxes: a 2 by 2 board (3 by 3 dots) to learn, 5 by 5 for experts. Schmitt's talk counts dots: his "4 by 4 game" is the 9-box board. Our game uses boxes, so check which a friend means before you draw.
- The extra line. Wikipedia says the player who completes a box "takes another turn"; MathWorld says they receive an additional move; Schmitt says they move again. None of them makes taking a box compulsory, and both Wikipedia and Allcock describe leaving boxes untaken as standard expert play. Allcock adds that after taking boxes you must move again unless the game is over. Our game uses that: the extra line is compulsory, taking boxes is your choice.
- How the chain rule is put. Schmitt states it for any board: dots plus long chains, even for the first player and odd for the second. Allcock gives the case where dots are even: the first player wants an even number of long chains. Wikipedia describes the double-cross and the fight for control but does not state the rule. They agree once you count the dots.
- The starting grid. Wikipedia, citing David Wilson's analysis, names the usual blank grid the American board, a grid with the outer border already drawn the Swedish board, and one with only the left and bottom sides drawn the Icelandic board. Our game offers the American and Swedish boards. A drawn border does not change which player wants even or odd, since the border has an even number of lines.
- Names and players. Wikipedia lists dots and dashes, game of dots, dot to dot grid, boxes and pigs in a pen, and says Édouard Lucas, who first published it in the 19th century, called it la pipopipette. It also says the game is for two players, sometimes more. Ours is for two.
House rules and variations
These are variations, not the standard game. Agree on them before the first line.
- Must take (house rule, a switch in our game). If you can complete a box, you have to. This removes the double-cross, so the chain rule no longer decides much and the game rewards counting safe lines instead. Good for young players.
- Border drawn first (Swedish board, a switch in our game). Shorter game, and the corner boxes start with two sides already drawn.
- Bigger or odd-shaped grids. Wikipedia notes the board can be any size, and that the game can be played on triangular or hexagonal grids. At home, 6 by 6 boxes or a long thin board like 3 by 7 work fine on paper.
- Three or more players (house rule). Take turns around the table with the same extra-line rule. The chain rule stops working cleanly, which makes it more of a party game.
Tips
- Never draw a third side while a safe line remains. A third side is a free box for the other player, and often the start of a chain for them.
- Count dots before the safe lines run out. On a 4 by 4 box board (25 dots) the first player wants an odd number of long chains. If the count is wrong for you, try to join two chains into one or cut one short before the board locks up.
- Give the cheapest thing first, and give a pair from the middle. Open single boxes before long chains. When you give away a chain of two, draw the line between the two boxes: each then has its own missing side, so the other player cannot hand them back with one line.
- Take all but two, unless the rest is small. If what is left after this chain is worth 2 or less to the controller, take every box and give up control. The chain counter's chain lengths are your guide.
- Loops cost twice as much to keep. To keep control on a loop you give back 4 boxes, so a 4-loop gives you nothing when you keep control. Steer the long chains you want and treat loops as a price.
Play online or at home
Online: the board at the top of this page, against the computer or passing one phone between two players.
At home: a sheet of paper and two pens in different colors. Graph paper saves drawing the dots. A 3 by 3 board fits on a napkin at a restaurant; a 5 by 5 board on a page makes a proper match.
Questions people ask
How do you play dots and boxes?
Draw a grid of dots. Two players take turns joining two dots that sit next to each other, across or down, with one line. Whoever draws the fourth side of a small box writes their initial in it and must draw another line. When every line is drawn, the player with more boxes wins.
Do you get another turn when you complete a box?
Yes. Completing a box scores it and you move again. The extra line is not optional: you keep drawing until you draw a line that completes nothing, or the board is full.
Do you have to take a box when you can?
Not in the usual rules. Strong players often leave the last two boxes of a chain for the other player on purpose, so that player has to open the next chain. Some families play that you must take any box you can; that is a house rule, and our game has a switch for it.
What is the long chain rule?
Elwyn Berlekamp's rule, as John Schmitt's talk states it: the first player wants the number of dots plus the number of long chains (three boxes or more) at the end to be even, and the second player wants it odd. On a 4 by 4 box board there are 25 dots, so the first player wants an odd number of long chains.
What is a double-cross?
One line that completes two boxes at once. It happens when a player takes all but two boxes of a chain and closes the far end, leaving two boxes that share one missing side. The other player takes both with one stroke and then has to open the next chain.
What size board should we play on?
Wikipedia suggests 2 by 2 boxes (3 by 3 dots) to learn and 5 by 5 boxes for experts, citing Berlekamp. 3 by 3 boxes plays in a couple of minutes; 4 by 4 or 5 by 5 gives the chain fight room to happen.