Towers game strategy

433 Views Asked by At

Given the following game, what is the strategy to win?

Given $N$ towers of different heights. Two players play against each other. Each player (in his turn) divides each of the towers which are greater than 1 into two separate towers. The player who wins is the one that after his (last) turn all towers are of height 1.

Any help would be appreciated.

1

There are 1 best solutions below

16
On

Are you familiar with Nim? As an impartial game, this is Nim in disguise. You need to figure out which positions are $N$ (wins for the next player) and $P$ (wins for the previous player). You only care about the largest stack because each player has to play in all stacks greater than $1$. A largest stack of size $1$ is $P$ by the rules. $2$ plays to $1$ and wins, so is $N$. $3$ has to leave a $2$, so is $P$. $4$ can move to $3$ and win, so is $N$. Keep going a while and try to find a pattern.