Grundy number
The Grundy number is a concept from combinatorial game theory used to determine the winning strategy in impartial games. It assigns a non-negative integer to each position in a game, indicating whether the position is winning or losing. A position with a Grundy number of zero is losing, while a non-zero Grundy number indicates a winning position.
To calculate the Grundy number, one considers all possible moves from a given position and finds the minimum excludant (mex) of the Grundy numbers of those resulting positions. This method helps players identify optimal strategies in games like Nim and Sprouts.