Nim game is a game problem, and the most important thing is to find a losing state. This state of losing means that if such a situation is in front of you, the first hand will lose. Its strict definition is as follows: 1, and the situation that no action can be taken is the state of losing; 2. The situation that can be transferred to the failed state is not the failed state; 3. The results of all operations in a failed state are non-failed. This is easy to understand, that is, if you are in a non-losing state, you can move to a losing state at any time and leave the losing state to the other party. If the other party is in a losing state, you can always move to a non-losing state, keep the non-losing state to yourself, and then continue to insult the other party.
For Nim games, if and only if the number of all stacked coins is XOR and the result is 0, this situation is a losing situation, that is:
a 1^a2^...^an=0
In order to prove it, we only need to prove that it satisfies the three properties of the above failure state.