Dotnbox.online › AI and Solvers

How Computers Solve Dots and Boxes

A strong computer opponent, a search engine, and an exact game solver are not the same thing. Dots and Boxes programs use search reduction, symmetry, stored positions, game-specific knowledge, simulations, and learned evaluation to make an enormous decision space manageable.

A computer can beat a human at Dots and Boxes without having solved the game. It can also calculate an excellent move without proving that the move is perfect. Those distinctions matter whenever we talk about AI, solvers, or “optimal” computer play.

An exact solver has a demanding job. It must show what happens against the best possible response, then the best response to that response, and continue until the final score is mathematically determined. A playing program has more freedom: it can search only part of the tree, estimate the rest, sample likely continuations, or use learned knowledge to choose a strong move quickly.

Dots and Boxes makes both tasks difficult. The board may look small, but many different move orders lead to the same position, scoring changes who moves next, and the number of possible continuations grows rapidly before the endgame simplifies.

Computer Dots and Boxes is therefore less about making processors “think harder” and more about preventing them from wasting work.

What Does It Mean for a Computer to “Solve” Dots and Boxes?

The word solver is often used loosely. Three different levels of computer analysis should be kept separate.

LEVEL 1 Move-playing AI

Chooses moves using rules, search, sampling, learned evaluation, or a mixture of methods.

Can be strong without proving its move is optimal.
LEVEL 2 Position solver

Calculates a particular board state deeply enough to determine its optimal result or best move.

The result applies to the position analyzed.
LEVEL 3 Full starting-board solution

Proves the game-theoretic result from an empty board under perfect play by both players.

Requires a proof over every relevant response.

A neural network that wins most games against ordinary players belongs in the first category. A program that proves a difficult late position is a win by three boxes belongs in the second. A published calculation showing that a complete board is a tie under perfect play belongs in the third.

KEY DISTINCTION Playing strength is empirical. An exact solution is a proof about optimal play.

A program can be stronger than almost every person it meets and still choose a non-optimal move in a position that has never been completely searched.

Why Brute-Force Search Becomes Huge So Quickly

A computer sees a Dots and Boxes position as a set of drawn and undrawn edges plus enough information to reconstruct the score and player to move.

On an m × n box board, the number of playable edges is:

PLAYABLE EDGES 2mn + m + n

That means a 4 × 5 box board contains 49 legal edge locations. A 5 × 5 box board contains 60.

Early in the game, many of those edges are available at once. A naïve search can branch from the first move to dozens of possible second moves, then dozens more possible third moves, continuing through a very large game tree.

START
M1 M2 M3 … Mn
↙ ↓ ↘ ↙ ↓ ↘
Each candidate creates another position with many possible continuations.

There is another problem: different move orders can produce the same board position.

If edge A and edge B can be played independently, the sequence A then B may reach the same state as B then A. A naïve program can spend time solving that identical state more than once.

This duplication is one of the main reasons efficient solvers do not simply enumerate every legal sequence from beginning to end.

Alpha-Beta Pruning Cuts Away Irrelevant Branches

Minimax tells a solver what to calculate. Alpha-beta pruning helps it avoid calculating branches whose result can no longer affect the final choice.

Suppose the solver has already found one move that guarantees a margin of at least three boxes. It begins analyzing another candidate and discovers that the opponent has a response making that candidate no better than a margin of one.

There is no need to finish exploring every continuation beneath that inferior branch. It cannot replace the already known better move.

KNOWN MOVE guarantees +3
compare
NEW BRANCH opponent can hold it to +1
✕ Stop searching deeper This branch cannot become the preferred move.

Alpha-beta pruning does not change the mathematically correct minimax result. It changes how much of the tree must be visited to prove that result.

Its effectiveness depends heavily on move ordering. If strong candidate moves are searched early, useful bounds are established sooner and more later branches can be cut off.

Transposition Tables Stop the Solver Repeating Work

Search trees contain sequences of moves. What matters strategically, however, is the position those sequences reach.

Two different histories can arrive at the same remaining edges, same score relationship, and same relevant player-to-move state. Re-solving that position wastes time.

PATH A
edge 7 → edge 12
PATH B
edge 12 → edge 7
↓
SAME RESULTING STATE Look it up instead of solving it again

A transposition table stores information about positions already searched. When the same effective state appears through another move order, the solver can reuse the previous result or bound instead of beginning from scratch.

Barker and Korf found that this was especially useful in Dots and Boxes because many move orders lead to equivalent states. Their solver stored both lower and upper minimax bounds in its table rather than only a single bound.

Memory therefore becomes part of the solving strategy: a larger useful table can exchange storage space for less repeated computation.

Symmetry Turns Several Positions Into One

An empty rectangular board looks the same after certain reflections. Square boards have still more symmetry.

If two positions are mirror images of each other, their minimax values are the same. A solver that recognizes this does not need to treat them as unrelated problems.

Position A
⇄
Mirror position
same minimax value

Barker and Korf exploited horizontal and vertical board symmetries, diagonal symmetry on square boards, and an additional corner-edge equivalence known from earlier Dots and Boxes analysis.

Their experiments reported consistent speedups from symmetry handling. This is a good example of a general solver principle: before searching two states separately, first ask whether they are mathematically the same state in disguise.

Game-Specific Chain Analysis Removes Huge Parts of the Tree

Alpha-beta pruning, transposition tables, and symmetry can be used in many games. The largest consistent improvement in Barker and Korf’s Dots and Boxes experiments came from something much more specific to this game: chain analysis.

Once a run of boxes becomes capturable, a naïve solver might still consider many possible ways to take some boxes, switch elsewhere, return later, or play different edges inside the component.

Mathematical strategy tells us that most of those sequences cannot belong to optimal play.

OPEN CAPTURE SEQUENCE Many legal continuations
↓ game-specific proof
A Take the component
B Use the relevant control-preserving handout

For a half-open capturable chain, Barker and Korf reduce the potentially optimal responses to two strategic families: take every available box, or use the established all-but-two control sequence. For their closed-chain case, the analogous alternatives are taking everything or leaving the four-box handout.

The point here is computational, not tactical. Those rules let the solver prove that many legal moves do not need to be searched at all.

Their experiments found chain analysis to be the most consistently useful optimization in the solver, with removing it increasing runtime by more than an order of magnitude on most benchmark positions. :chatgpt-content-reference{index=”2″}

This is one of the clearest examples of mathematics and software engineering reinforcing each other: understanding the game reduces the amount of computation needed to solve it.

What the Famous 4 × 5 Solution Actually Proved

Joseph Barker and Richard Korf used their enhanced alpha-beta solver to analyze an empty board containing 4 × 5 boxes.

Their result was a tie under optimal play.

4 × 5 boxes
Playable edges 49
Boxes 20
Perfect-play result Tie

The importance of the result is not that computers discovered a clever move against an average opponent. The search established that, from the empty starting position, neither player can force more than half of the 20 boxes when both sides play optimally.

The authors reported that the search required roughly ten days on a 3.33 GHz Intel Xeon system using a 24 GB transposition table. At the time of publication, they described 4 × 5 as the largest complete Dots and Boxes board solved. :chatgpt-content-reference{index=”3″}

READ THE CLAIM PRECISELY “4 × 5 was solved” does not mean every larger Dots and Boxes position is unknown.

Individual positions on larger boards can be analyzed or solved, and later work has produced strong computer players for larger games. A full starting-board proof is a much stronger claim than solving selected positions.

Reports and unpublished claims about larger starting boards should likewise be distinguished from a comparable peer-reviewed full-board proof. That distinction keeps “solved,” “strongly played,” and “experimentally successful” from being treated as synonyms.

Monte Carlo Tree Search Takes a Different Approach

Exact alpha-beta search tries to establish what must happen under optimal play. Monte Carlo Tree Search (MCTS) can instead spend its available time sampling promising continuations and improving estimates.

A standard MCTS cycle has four broad stages.

01 Selection Follow promising nodes already in the tree.
→
02 Expansion Add a new candidate continuation.
→
03 Simulation Estimate what happens from the new state.
→
04 Backpropagation Feed the result back through visited nodes.

Repeating that process many times concentrates more computation on moves that appear promising.

This makes MCTS attractive when searching the complete tree is too expensive. But sampling quality matters. Random-looking simulations can misunderstand Dots and Boxes badly because apparently quiet opening moves can determine chains that are collected much later.

Researchers have therefore experimented with combining MCTS with Dots-and-Boxes-specific heuristics. A 2016 study by Junkai Lu and Hang Yin, for example, used a heuristic solver to stop some MCTS simulations before reaching the literal end of the game and reported stronger performance from the combination. :chatgpt-content-reference{index=”4″}

Neural Networks and Reinforcement Learning Have Also Been Tested

Search algorithms need a way to decide which positions or moves look promising when they cannot calculate everything to completion.

Hand-written heuristics are one option. Learning is another.

POSITION Board representation
→
MODEL Learn patterns from games
→
OUTPUT Move preference or position value

Neural-network work on Dots and Boxes goes back decades. A 1998 study by Lex Weaver and Terry Bossomaier evolved neural networks that recommended moves and compared their play with heuristic opponents. Later research combined neural evaluation with Monte Carlo search. :chatgpt-content-reference{index=”5″}

A 2020 study by Li and colleagues used deep convolutional neural networks for two separate tasks: a value network to assess positions and a strategy network to recommend play. Their systems combined those networks with MCTS and used complete alpha-beta search deeper in the process when positions became manageable. The authors reported strong play against human opponents. :chatgpt-content-reference{index=”6″}

Other experiments have compared Q-learning, MCTS, minimax, and rule-based agents. One such study found that its traditional rule-based agent remained difficult for the newly implemented learning and search agents to beat, with its particular MCTS implementation performing worst among those tested. :chatgpt-content-reference{index=”7″}

DO NOT OVERGENERALIZE ONE EXPERIMENT “MCTS,” “Q-learning,” or “neural network” names do not determine playing strength by themselves.

Performance depends on the board representation, training data, evaluation function, simulation policy, search budget, implementation quality, and game-specific knowledge built around the method.

Why Hybrid Dots and Boxes Programs Make Sense

The game becomes easier to evaluate as the board fills.

Early positions contain many legal edges and long-term structural uncertainty. Late positions often collapse into recognizable chains, loops, and forced capture sequences that can be searched or solved much more precisely.

That naturally suggests a hybrid architecture.

EARLY GAME Heuristic or learned guidance

Rank moves without attempting a complete proof from every candidate.

→
MIDDLE GAME Focused search

Use MCTS, alpha-beta, or learned evaluation to spend effort on plausible continuations.

→
LATE GAME Exact calculation

Switch to game-specific reductions and full search when the remaining position becomes tractable.

This is not merely theoretical. Published Dots and Boxes research has combined MCTS, neural evaluation, and alpha-beta completion in the same system. :chatgpt-content-reference{index=”8″}

The design reflects an important engineering principle: use expensive proof where it is affordable and cheaper estimates where exhaustive calculation is still too large.

Exact Solver vs Strong AI: What Is the Difference?

Question Exact solver Playing AI
Main goal Prove the optimal result Choose a strong move quickly
May estimate positions? Not in the final proof unless bounds are rigorous Yes
Can use neural networks? As guidance, but proof still needs exact reasoning Yes
Must inspect all relevant optimal responses? Yes, directly or through valid pruning No
Typical output Win, loss, tie, or exact score margin A recommended move
Can it make a mistake? Not if the proof and implementation are correct Yes

This distinction is especially useful when evaluating online games. A difficulty level labelled “AI” may use a few hand-written rules, a shallow minimax search, MCTS, a neural model, or a mixture. None of those labels alone tells you whether the starting board has been solved.

What Solver Research Reveals About the Game

The most interesting lesson from Dots and Boxes solvers is not that a processor can examine more positions than a person.

It is that the fastest programs improve dramatically when they stop treating every legal move as equally worthy of investigation.

1 Recognize equivalent positions.

Symmetry and transpositions prevent repeated analysis of the same underlying state.

2 Use game structure to eliminate nonsense.

Chain analysis removes legal continuations that mathematical reasoning shows cannot be optimal.

3 Search important choices first.

Better move ordering creates stronger bounds and allows more of the remaining tree to be pruned.

4 Change method as the board changes.

Approximation can be useful early; exact calculation becomes increasingly practical when the position contracts.

Those are computational principles, but they mirror strong human play surprisingly well. Good players also stop evaluating every line as an isolated option. They group equivalent ideas, recognize forced structures, and spend most of their attention on the few decisions that can actually change the result.

For the underlying graph theory, controlled values, and complexity results that explain why these reductions exist, see the mathematics of Dots and Boxes.

You can also compare different kinds of positions yourself while you play Dots and Boxes online: early in the board, count how many plausible edges remain; later, notice how quickly the choices collapse once chains and forced captures appear.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *