An impartial game is a game in which both players have the same legal moves from any given position. Under the normal-play convention, a player with no legal move loses. For finite games without draws, Grundy numbers encode positions for the Sprague-Grundy theorem.
An impartial game played under the normal-play convention.
Sprague-Grundy theory studies finite acyclic impartial games under the normal-play convention by assigning each position a Grundy number. The assignment recursively takes the minimum excludant of the values of all legal followers. The Sprague-Grundy theorem then reduces a disjunctive sum of games to the bitwise exclusive or of its component values. This framework explains both why a zero value is losing and how independently understood games can be combined without exploring the entire product of their state spaces.
Every finite acyclic impartial game under the normal-play convention has a Grundy number. The Grundy number of a sum of independent games is the bitwise exclusive or of their individual Grundy numbers, so the sum is losing exactly when that value is zero.
A subtraction game has a heap of nonnegative integer size. A legal move subtracts an allowed positive amount without making the size negative; normal play declares an empty move set losing.
In a disjunctive sum of games, each move changes exactly one component game. Under normal play, a player loses when no component has a legal move.
Fibonacci Nim is a normal play impartial game on one heap. Start with counters. The first move removes between and counters; thereafter a move removes at least one and at most twice the number just removed by the opponent, without exceeding the remaining heap. Taking the last counter wins.
For a position with counters and permitted maximum , let be the smallest Fibonacci number appearing in the Zeckendorf representation of , using the sequence . The position is losing exactly when . If , removing is a winning move. When this does not empty the heap, the next smallest summand exceeds , so the opponent's new limit is too small. Conversely, the Zeckendorf subtraction lemma gives whenever , so every legal move from a losing position leaves a winning one.[ref]
Fibonacci Nim by Michael J. Whinihan. Pages 9–12: rules, least-summand criterion and proof
Initially , so the losing initial heap sizes are precisely the Fibonacci numbers. For example, : take , leaving the opponent counters and a limit of , a losing position. The move limit is part of the state; heap size alone does not determine later positions.
A Euclid game is an impartial game based on subtraction steps of the Euclidean algorithm.[ref]
A Game Based on the Euclidean Algorithm and a Winning Strategy for It by A. J. Cole and A. J. T. Davie. Original paper introducing Euclid; terminal convention is specified explicitly below
Here use the following normal-play convention: a position is an ordered pair ; if , remove a positive multiple from and reorder. A position with has no legal move and is losing. Thus moving to a zero coordinate wins; variants that instead stop at equal positive coordinates require a different endpoint convention.The sum of the coordinates strictly decreases, so every play terminates. If divides , subtract and win immediately. If , there is only one move, to , so the position has the opposite winning status from that successor.
If with and , two legal choices leave or . The latter has exactly one move, to the former, so exactly one of these two successors is losing. Choose it. For example, is losing because its only move reaches , where the opponent takes the whole larger coordinate. From , subtract to leave that losing position. These cases give a recursive strategy without exploring every subtraction amount.
The value of a game position, where mex is the smallest nonnegative integer missing from the values of its legal successors. Terminal positions have value zero. The Sprague-Grundy theorem explains why these values combine by exclusive or.
For finite nimbers, multiplication is recursively defined from smaller arguments bywhere is Nim-sum and mex selects the smallest missing nonnegative integer. Thus zero times anything is zero and one times is . For , the displayed set is , so .
Together with Nim-sum, this is field arithmetic on finite nimbers, rather than ordinary integer multiplication. In particular cannot be computed by a usual integer product or bitwise exclusive or.[ref]
https://circles.math.ucla.edu/circles/lib/data/Handout-4717-4806.pdf. Aaron Anderson, Nimbers, 3 October 2021, multiplication definition
An impartial game played with heaps of counters: a move removes a positive number of counters from exactly one heap. Under the normal-play convention, a position is losing exactly when the bitwise exclusive or of its heap sizes is zero.
A Nim heap of size contains counters and permits removing any positive number, leaving a heap of any size . Under the normal-play convention, its Grundy number is : the reachable values are exactly , whose mex is .
For several heaps, a turn changes exactly one heap. Their combined value is the Nim-sum of the heap sizes, so heaps of sizes three and three form a losing position even though either heap alone is winning. The ability to remove arbitrarily many counters is part of the rule; a bounded-removal subtraction game has different values.
The bitwise exclusive or of a list of nonnegative integers. For heap sizes in ordinary Nim, a zero nim-sum characterizes a losing position under the normal-play convention.
In a finite impartial game with the normal-play convention and no draws, a losing position is one from which the player whose turn it is cannot force a win against best play. It is also called a P-position, since the previous player wins.
A terminal position is losing. Recursively, a position is winning if it has at least one move to a losing position, and losing if every legal move goes to a winning position. Induction on the finite remaining game tree proves this classification. For a single Nim heap, only the empty heap is losing. Infinite plays and misère play need separate conventions and can change the base case.
Articles by others on the same topic
An impartial game is a type of combinatorial game in which the possible moves available to each player depend only on the current state of the game, and not on which player is currently taking their turn. This means that the options available to both players are the same regardless of who is playing. In impartial games, the rules apply equally to both players, and the game ends when there are no legal moves left.