A nim-game variant

433 Views Asked by At

Suppose a bucket contains n balls. In each turn one removes some balls k from the basket. If first player removes even-number balls then second player must removes odd-number of balls and vice-versa. The winner is who plays the last turn and makes the bucket empty. The game is tie when it is impossible to make the bucket empty. Assume both players play optimally. Here optimally means a player plays in a way so that the opponent player does not win. 0

1

There are 1 best solutions below

6
On

Hint: think first about what happens when $n$ is odd. The strategy is rather simple then. There is no reason that $n$ is limited to small numbers. You can compute the winner in one line.