Impartial 4x4 Nimber Explorer

This demo computes and explores Grundy values for all 65,536 positions of a finite impartial game on a 4x4 board.

Rules, impartiality, and nimbers

Rules (normal play)

  • A position is a 4x4 board of filled/empty squares.
  • On each move, remove one filled square, or two filled orthogonal neighbours.
  • The player who makes the last move wins.

Why this is impartial

Both players have exactly the same legal moves from every position. There is no hidden information and no chance moves. So this is an impartial combinatorial game under normal play.

Grundy (nimber) value

The nimber of a position is the mex of the nimbers of all legal options. Nimber 0 means a losing position for the player to move; non-zero means winning with correct play.

Historical context: this is a 2D finite variant of the classic Kayles move pattern (remove one or two adjacent tokens). The Sprague-Grundy framework (Sprague and Grundy, 1930s) gives a complete value-theoretic classification for finite impartial normal-play games, though computing nimbers can still be difficult in practice.

Interactive explorer

Computing Grundy table for all 2^16 positions...

Nimber: 0

Bit string order is row-major from top-left to bottom-right.

Move Result state Result bits Nimber(result)

Positions with maximal nimber

Click any listed position to load it into the main board.