Online Dots and Boxes Game
Play Dots and Boxes against a seeded computer or a friend on the same screen, with capture previews to help plan and compare your moves.{{ hud.lastMove }}
Move history · {{ hud.moves }} edges
- {{ move.player }} · {{ edges[move.edge].label }} · +{{ move.boxes.length }} {{ move.boxes.length === 1 ? 'box' : 'boxes' }}
Run details
- Seed
- {{ identity.seed }}
- Rules
- {{ identity.rulesVersion }}
The point belongs to the player who draws a box's fourth side, even when the other player drew its first three. Dots and Boxes is a two-player territory game played on a grid of dots. Each move adds one horizontal or vertical line, called an edge, between neighboring dots. Completing one of the small squares claims that box for one point. Drawing a larger outline around several squares does not claim the area inside.
Until the board is full, a capture also keeps the turn with the player who made it. Closing two boxes with one edge earns two points, but it still means one next move, not two extra moves saved for later. A player continues for as long as each new line captures a box. Once a line closes no box, the other player takes over.
Early in a game, adding the third side of an unclaimed box leaves an immediate scoring opportunity. That opportunity passes to the opponent unless the same line captures another box and lets the current player continue. An interior edge touches two boxes, so a line that looks harmless beside one square can create an opening beside the other.
As the board fills, boxes connected by undrawn edges can form a chain of successive captures. Giving an opponent access to a long chain can reverse a lead because every capture lets that player keep drawing. Counting current points without looking at these remaining opportunities can make a strong-looking position misleading.
Another move does not force a player to take an available box. In endgames made up of separate long chains of at least three boxes, deliberately leaving two boxes for the opponent can help retain control of the next chain. This sacrifice trades immediate points for later captures and depends on the rest of the position. The winner is whoever owns the most boxes when all are claimed, not whoever drew the most lines or led early.
How to Use This Tool:
The default match uses a 3 × 3 box board against the computer. Player A always moves first and is the human player in computer mode.
- Choose a Board size of 2 × 2, 3 × 3 or 4 × 4 boxes. Set Opponent to Computer · seeded practice or Two local players, where both players use the same screen.
- Keep the prefilled Replay seed or replace it with 1 to 96 characters, then select Start match. Spaces at the beginning and end are ignored.
A blank or all-space Replay seed leaves Start match disabled, including in Two local players mode.
- Hover over an open edge, or cycle through open edges with the arrow keys while the board is focused, to inspect its preview. Preview is shown initially and can be turned off with Hide preview.
- Draw an edge by clicking or tapping it, or press Enter or Space for the selected edge. Computer B replies automatically when the turn passes to B and keeps drawing after captures. There is no single-move undo.
When every box is claimed, compare the final scores and box ownership. Replay same seed starts again; New seed keeps the size and opponent with another seed. Change setup returns to the match choices.
Pause, or P while the board is focused, holds the position. Switching to another tab or away from the window also pauses play. Resume continues from that position. Restart clears the board but keeps the same setup and seed.
Interpreting Results:
The scores count claimed boxes. The edge counter and Move history count drawn lines, so several consecutive entries by the same player can be correct. Move history identifies each edge by its orientation, row and column and shows any boxes claimed.
The selected-edge preview describes three different quantities. None of them adds points until a line is actually drawn.
- Immediate captures
- The boxes the selected edge would close now. The highlighted boxes show these immediate captures only, not every box in a possible continuation.
- Capture continuation
- The number of additional boxes found by repeatedly taking an available capture until none remain or the board is full. These captures can occur elsewhere on the board, not just in one connected chain. The number counts boxes, not extra moves. This capture-only sequence is not a prediction of optimal play or of the computer's actual replies.
- Three-sided boxes left open
- For a non-capturing move, this counts all unclaimed boxes with exactly three sides after the selected line is drawn. It includes boxes that were already three-sided, not only ones created by that move. Zero means no immediate box is left ready to close; it does not prove the move is strategically best.
Technical Details:
Each box is awarded once, when all four of its edges have been drawn. The ownership of those earlier edges does not affect who gets the box. An interior edge belongs to two box boundaries, which is why one line can complete two boxes at once.
Rule Core
Only an unclaimed horizontal or vertical edge between adjacent dots is a legal move. The number of boxes it completes determines both the score change and who draws next.
| Boxes completed | Points added | Next player if boxes remain |
|---|---|---|
| 0 | 0 | The other player |
| 1 | 1 | The player who drew the edge |
| 2 | 2 | The player who drew the edge |
Drawing an already claimed edge does not count as another move. When every box is owned, the match ends immediately. Having an unbeatable lead does not end it early. Higher scores win and equal scores draw, with no time bonuses or fractional points.
Formula Core: board totals
A board with three boxes across needs four dots across. More generally, let n be the number of boxes per side, B the total boxes and E the total drawable edges, counting both horizontal and vertical lines.
| Board size in boxes | Dot grid | Total boxes | Total edges |
|---|---|---|---|
| 2 × 2 | 3 × 3 | 4 | 12 |
| 3 × 3 | 4 × 4 | 9 | 24 |
| 4 × 4 | 5 × 5 | 16 | 40 |
The two final scores must add up to the total boxes. A 2 × 2 board can finish tied at 2 points each, and a 4 × 4 board at 8 points each. A completed 3 × 3 board cannot be tied because its nine points cannot be split equally.
How the computer chooses
Computer B uses a capture-first rule rather than searching for the best final score. On every move, it considers the first available group below.
- If any moves complete a box, choose among those capturing moves.
- Otherwise, prefer moves that do not add a third side to any adjacent unclaimed box.
- If no such move exists, choose among all remaining open edges.
The seed selects between candidates within that group. A move that closes two boxes is not automatically preferred over one that closes a single box. B repeats this selection after each capture while it keeps the turn. The computer does not plan long-chain sacrifices or guarantee optimal play.
FAQ:
Does replaying the same seed repeat the whole match?
The replay starts with an empty board; it does not draw previous moves for you. The same rules, board size, opponent, seed and sequence of human moves reproduce the same computer replies. Changing your moves can change those replies even with an unchanged seed. A new seed changes how similarly preferred computer moves are chosen, not the starting grid, and a different result is not guaranteed. In local two-player mode, the seed does not affect play. Scores are for play and have no monetary value.
What is saved between visits?
Play and computer decisions run in your browser. Up to 18 recently completed results are kept in this browser across all board sizes and opponent choices. Each record stores the scores, board size, opponent, seed and rules version, not a full move history. The setup count includes only records matching the selected size and opponent. In Recent local matches, Clear local record removes saved results when browser storage is available. If storage is unavailable, new results remain only for the current visit. Unfinished matches are not restored after reloading or closing the page.
References:
- Dots and Boxes, UCLA Department of Mathematics.
- Some Strategy for Dots and Boxes, UCLA Department of Mathematics.