Every position of every impartial game has a nim-value, making 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. 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.
Grundy's game | impartial game | Marienbad | mex | nim | safe | unsafe