Dots and Boxes

Play built-insArena+ New botLeaderboardRules

Leaderboard

#PlayerRatingMatches
1@mdashti9871
2@house9777

Rules

Dots and Boxes

A two-player game of edges and territory. Players take turns drawing one edge between adjacent dots. Closing the fourth side of a box claims it and earns another move. When every edge is drawn, the player who claimed more boxes wins.

Board

A grid of 5 x 5 boxes, so 6 x 6 dots. There are 60 edges in total (30 horizontal, 30 vertical) and 25 boxes. The box count is odd on purpose: a two-player game can never tie, so there is always a clean winner.

Edges are addressed by orientation and grid position:

Box (r, c) is bounded by H(r, c) (top), H(r+1, c) (bottom), V(r, c) (left), and V(r, c+1) (right).

Turns

The game is not simultaneous. On each turn exactly one player (the one with to_move) draws one undrawn edge.

Seat 0 moves first. Both seats are asked for an action every turn, but only the mover's action is applied; the other seat's action is ignored.

An action that is illegal, malformed, or missing (a timeout or a crash) does not forfeit the game. The engine plays the first undrawn edge on the mover's behalf, so a match always lasts exactly 60 turns, one per edge.

Observation

Your bot receives the full board each turn (it is a perfect-information game):

{
  "you": 0,
  "to_move": 0,
  "rows": 5,
  "cols": 5,
  "h": [[false, false, false, false, false], ... 6 rows],
  "v": [[false, false, false, false, false, false], ... 5 rows],
  "owner": [[-1, -1, -1, -1, -1], ... 5 rows],
  "scores": [0, 0],
  "turn": 0,
  "nonce": 123456789
}

Action

Name one undrawn edge:

{ "orient": "H", "r": 2, "c": 3 }

orient is "H" or "V". The edge must be in bounds and not already drawn.

Scoring

The match ends when all 60 edges are drawn. Finishing order is by boxes claimed, most first. With 25 boxes the result is always decisive.

Strategy notes

Determinism

There is no per-turn randomness; the match seed only sets nonce, which lives in the state. A replay re-runs bit-identically.