A toroidal chessboard is an ordinary n×n grid in which opposite edges are glued together. The top row and the bottom row become neighbours, and the leftmost column and the rightmost column become neighbours. Topologically the result is a torus — the surface of a donut.
On a standard chessboard a queen placed in a corner attacks only three directions along the edge. On a toroidal board every queen attacks in all eight directions without limit, because a ray that exits one side immediately re-enters from the opposite side. This simple change has profound consequences for how many queens can be placed without conflict.
Visualising the Wrap-Around
Imagine the classic arcade game Pac-Man: when the character moves off the right side of the screen it reappears on the left. The toroidal chessboard works exactly the same way, but in both horizontal and vertical directions simultaneously.
Concretely, a queen at position (r, c) on an n×n torus attacks:
- Same row: all cells (r, x) for x ≠ c, where column indices are taken mod n.
- Same column: all cells (x, c) for x ≠ r, where row indices are taken mod n.
- Main diagonal (↘ direction): all cells (r+k, c+k) mod n for k = 1, …, n−1.
- Anti-diagonal (↗ direction): all cells (r−k, c+k) mod n for k = 1, …, n−1.
Because every diagonal on a torus wraps around and has exactly n cells, there are exactly 2n distinct diagonals (n in each direction). Two queens conflict on the main diagonal if (r₁−c₁) ≡ (r₂−c₂) (mod n), and on the anti-diagonal if (r₁+c₁) ≡ (r₂+c₂) (mod n).
Why the Donut Shape?
Mathematically, the torus is formed by taking the unit square [0,1]×[0,1] and identifying the pair of horizontal edges and the pair of vertical edges. The result is a surface with no boundary at all — every point on a torus looks locally identical to every other point. This is why the toroidal queens puzzle has a much higher degree of symmetry than the ordinary puzzle: rotations of the board by 1/n of a turn (i.e., cyclic shifts of rows or columns) map solutions to solutions.