2. Game of Nim #
Created Sunday 02 August 2020
-
Rule - Any player can remove any number of stones from a pile.
-
Loser - The first person who has no stones to remove loses.
-
Nimsum = XOR of all the stones in the piles, e.g 3 ^ 4 ^ 5.
Theorem of Nim:
if(nimsum==0)
player 1 loses;
else
player 1 wins;
// assuming both are playing optimally