Skip to content
poozee

Strategy Guides

Dots and Boxes 3x3 Solution: Who Wins With Perfect Play

The 3x3 dots and boxes board is solved: the second player wins 6-3 with perfect play. See every opening, the move that decides it, and how to beat the computer.

By Poozee Editors7 min read

On a 3x3 board (nine boxes, 16 dots), the second player wins 6 boxes to 3 with perfect play. It doesn't matter where the first player starts: all 24 possible opening lines lose by exactly three boxes. The whole game turns on one idea from the dots and boxes strategy guide: the second player needs an odd number of long chains, and the positions below show what that looks like on this board.

How we solved it

A position in dots and boxes is just the set of lines drawn so far: that alone decides which boxes are closed and what's left to fight over. The 3x3 board has 24 lines, so there are 2^24 = 16,777,216 possible sets of lines. We wrote a program that works out the exact value of every one of them, starting from the full board and working back to the empty one, trying every legal line in every position. It takes no shortcuts.

As a second check, we asked the separate solver that runs the Hard level of Poozee's Dots and Boxes. It searches the game a different way, and it agrees on the empty board and on all 24 first lines. Barker and Korf's paper Solving Dots-And-Boxes (AAAI 2012) states the same result: 3x3 is a second-player win by three boxes.

Here's how the smallest square boards compare:

Board Dots Lines Winner with perfect play Score
1x1 4 4 Second player 1‑0
2x2 9 12 First player 3‑1
3x3 16 24 Second player 6‑3

On 2x2 the first player has to start on the outside: all 8 outer lines win 3‑1, while the 4 inner lines only tie 2‑2. Poozee's game offers 3x3, 4x4 and 5x5, but the bigger two have 40 and 60 lines, and 2^40 is already over a trillion positions, far too many to list this way.

Every first move loses by three

The 24 lines of an empty 3x3 board fall into four groups. Rotating or flipping the board turns any line into any other line of its group, so lines in the same group always have the same value.

One line from each group: the top edge at a corner, the middle of the right edge, an inner line that touches the edge, and a side of the center box. All four lose 3 to 6.

Whatever the first player draws, the second player has 23 replies. None of them loses the game, but not all of them keep the full 6‑3 win:

First line Lines like it Replies that keep 6‑3 Replies that drop to 5‑4
Outer edge at a corner 8 19 4
Middle of an outer edge 4 20 3
Inner line touching the edge 8 21 2
Side of the center box 4 5 18

So there is no winning first move, only better and worse tries. A side of the center box is the first player's best practical choice: it's the only opening where most replies give back a box.

When the second player can go wrong

The second player's first reply can't lose, but the room for error shrinks fast. We looked at every position where the second player is about to draw a line, no box has been taken yet, and the second player can still win, and counted how many of them contain at least one line that loses the game:

Second player about to draw Positions With a losing line
Line 2 24 0
Line 4 2,024 212 (10%)
Line 6 42,308 17,700 (42%)
Line 8 334,656 290,500 (87%)

By the eighth line, most positions hide a trap. The next section shows one, and why it loses.

The deciding move: make a loop, not a chain

This position comes from a game where both players made only best moves so far (our program checked each of the 11 lines). The second player is to move and is on course for 6‑3. Four safe lines are left, highlighted.

The second player to move after 11 lines. Four safe lines are highlighted: two along the top edge, one under the top-middle box and one between the top-left and top-middle boxes. Only one keeps the win.

The bottom row is already a chain of three. What matters is the six boxes on top:

  • The top edge of the top-left box is the only winning line. If the first player answers with the top edge of the top-middle box, the second player draws the line under that box (or the other way round). The six top boxes close into a loop around the line in the middle, and the second player wins 6‑3.
  • The line under the top-middle box, or the line between the top-left and top-middle boxes, loses 2‑7. The first player's best answer is the other one of the two, and the six boxes become a chain with both ends at the top edge.
  • The top edge of the top-middle box loses 4‑5.

Here's the right result. It's the first player's move, no safe lines are left, and every line opens the loop or the chain:

After the right line: a loop of six (green) and a chain of three (blue). The first player's best is to open the loop, with the highlighted line.

And here's the wrong one. The second player drew one of the losing lines and the first player split the top boxes the other way:

After a wrong line: a chain of six (green) and a chain of three (blue). Now the second player has to open one, and loses 2 to 7.

This is the long chain rule at work. Add the number of dots to the number of long chains (three boxes or more; loops don't count). If the total is even, the first player gets control; if it's odd, the second player does.

  1. Loop of six plus chain of three: 16 dots + 1 long chain = 17, odd. The second player has control and wins 6‑3.
  2. Chain of six plus chain of three: 16 dots + 2 long chains = 18, even. The first player has control and wins 7‑2.

Same six boxes. The only difference is whether they close into a loop or open into a chain, and that one line turns a 6‑3 win into a 2‑7 loss.

Pro tip: On 3x3, the second player wants exactly one long chain. When six boxes are about to join up, check whether your line makes a loop (which doesn't count) or a second long chain (which hands over control).

The finish: take the loop, double-deal the chain

Back in the loop position, the first player has two ways to go, and both lose:

  • Open the loop (the highlighted line): the second player takes all six boxes and then has to open the chain of three, which the first player takes. Final score 6‑3. Keeping control here would mean handing four loop boxes back to win the three in the chain, a 5‑4 finish, so grabbing everything is right.
  • Open the chain of three at one end: the second player takes one box and then draws the line at the far end, leaving the last two as a pair. The first player takes the pair and has to open the loop, and the second player takes all six: 7‑2.

The second option hides the mistake that flips the result. If the second player greedily takes all three chain boxes, they then have to open the loop themselves, and the first player takes all six to win 6‑3. Giving back two boxes, a move called double-dealing, is what keeps the win.

Beating the computer on 3x3

Because the second player always wins with perfect play, moving second you can beat every level of Poozee's game every time. Moving first is a different story. We played 1,000 games of a perfect first player (choosing at random among its best lines) against each level, with a fixed random seed for each game:

Computer level Perfect player moving first Perfect player moving second
Easy wins 946 of 1,000 wins every game
Medium wins 934 of 1,000 wins every game
Hard wins 29 of 1,000 wins every game

Easy and Medium draw their early lines at random, so they walk into the traps above. Hard picks its first line at random too, and usually its second, but from its third line on (19 or fewer lines left) it searches every move and plays perfectly. That leaves one real chance: its second line, the fourth of the game. We worked out the odds exactly. If you open with a side of the center box and then pick the third line that sets the best trap, Hard goes wrong 2 times in 19 (about 11%). Open with the middle of an outer edge and Hard can't go wrong at all.

Keep playing

Try it yourself: set Dots and Boxes to 3x3, move second, and aim for one long chain. Then read the full dots and boxes strategy guide for double-dealing on bigger boards, where the chain count is harder to steer. If you like solved games, tic-tac-toe is another one where perfect play decides everything, and you can test it in Tic-Tac-Toe.

Frequently asked questions

Who wins 3x3 dots and boxes with perfect play?

The second player, by 6 boxes to 3. We worked out every possible position on the 3x3 board (16 dots, 24 lines), and all 24 of the first player's opening lines lose by exactly three boxes.

What is the best first move in 3x3 dots and boxes?

None of them wins: against perfect defense every first line loses 3 to 6. A side of the center box is the best try, because only 5 of the second player's 23 replies keep the full 6-3 win, and it gives Poozee's Hard computer the most chances to go wrong.

Who wins 2x2 dots and boxes?

The first player, 3 boxes to 1, by starting with a line on the outside edge. Starting with one of the four inner lines lets the second player hold a 2-2 tie.

Have bigger dots and boxes boards been solved?

Yes, with much bigger programs than ours. Joseph Barker and Richard Korf solved the 4x5 board (20 boxes) in 2012 and found it a tie with perfect play.