In the
Sprague–Grundy theory the minimum excluded ordinal is used to determine the
nimber of a
normal-play impartial game. In such a game, either player has the same moves in each position and the last player to move wins. The nimber is equal to 0 for a game that is lost immediately by the first player, and is equal to the mex of the nimbers of all possible next positions for any other game. For example, in a one-pile version of
Nim, the game starts with a pile of stones, and the player to move may take any positive number of stones. If is zero stones, the nimber is 0 because the mex of the
empty set of legal moves is the nimber 0. If is 1 stone, the player to move will leave 0 stones, and {{math|1=mex({0}) = 1}}, gives the nimber for this case. If is 2 stones, the player to move can leave 0 or 1 stones, giving the nimber 2 as the mex of the nimbers {{math|{0, 1}.}} In general, the player to move with a pile of stones can leave anywhere from 0 to stones; the mex of the nimbers {{math|{0, 1, …,
n − 1} }} is always the nimber . The first player wins in Nim
if and only if the nimber is not zero, so from this analysis we can conclude that the first player wins if and only if the starting number of stones in a one-pile game of Nim is not zero; the winning move is to take all the stones. If we change the game so that the player to move can take up to 3 stones only, then with stones, the successor states have nimbers {{math|{1, 2, 3},}} giving a mex of 0. Since the nimber for 4 stones is 0, the first player loses. The second player's strategy is to respond to whatever move the first player makes by taking the rest of the stones. For stones, the nimbers of the successor states of 2, 3, and 4 stones are the nimbers 2, 3, and 0 (as we just calculated); the mex of the set of nimbers {{math|{0, 2, 3} }} is the nimber 1, so starting with 5 stones in this game is a win for the first player. See
nimbers for more details on the meaning of nimber values. ==References==