TOPICS
Search

Nim-Value


The nim-value of a position of a finite normal-play impartial game makes it equivalent to a nim-heap. To find the nim-value (also called the Sprague-Grundy number), take the mex of the nim-values of the possible moves. In the game of nim, the nim-value can also be found by writing the number of counters in each heap in binary, adding corresponding binary digits (mod 2), and interpreting the resulting binary string as a decimal number.

Under normal play, a position of nim-value 0 is safe for the player who has just moved, since the player next to move loses against correct play. A position of nonzero nim-value is unsafe for the player who has just moved, since the next player can force a win. With two heaps in the game of nim, the only safe positions are (x,x). With three heaps (assuming nim-heaps of maximum size 7), the safe positions are (1, 2, 3), (1, 4, 5), (1, 6, 7), (2, 4, 6), (2, 5, 7), (3, 4, 7), and (3, 5, 6). For four nim-heaps of maximum size 7, the safe positions are (x,x,x,x), (x,x,y,y), and (1, 2, 4, 7), (1, 2, 5, 6), (1, 3, 4, 6), (1, 3, 5, 7), (2, 3, 4, 5), (2, 3, 6, 7), and (4, 5, 6, 7). The position (1, 3, 5, 7) corresponds to the beginning state for the game Marienbad, which is therefore an unfair game.


See also

Divisor Nim, Grundy's Game, Impartial Game, Marienbad, Mex, Nim, Safe, Unsafe

Explore with Wolfram|Alpha

References

Ball, W. W. R. and Coxeter, H. S. M. Mathematical Recreations and Essays, 13th ed. New York: Dover, pp. 36-38, 1987.Grundy, P. M. "Mathematics and Games." Eureka 2, 6-8, 1939.Sprague, R. "Über mathematische Kampfspiele." Tôhoku J. Math. 41, 438-444, 1936.

Referenced on Wolfram|Alpha

Nim-Value

Cite this as:

Weisstein, Eric W. "Nim-Value." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Nim-Value.html

Subject classifications