Winnable Starting States in Zagreb and Yerevan’s Modified Nim Game with Fibonacci Constraints

34 Views Asked by At

problem statement

Zagreb and Yerevan play a restricted version of nim as follows: They start with 2 possibly empty (but not both empty) piles of rocks, and take turns Z-Y-Z-Y-Z... until the last player who has a move wins. On a turn, each must take at least one rock out of exactly one pile, so that the total number of rocks in both piles becomes a Fibonacci number. (The starting state need not have a Fibonacci total, but all successive states must.)

An example game: $(5 \text{ rocks}, 5 \text{ rocks}) \to (5 \text{ rocks}, 3 \text{ rocks}) \to (0 \text{ rocks}, 3 \text{ rocks}) \to (0 \text{ rocks}, 0 \text{ rocks})$

A positive integer $n$ is chosen. How many starting states, with the rocks totaling at most the $n$th Fibonacci number, are winnable by Zagreb, assuming perfect play?

My try

Let's start by calculating some states. A winning state is one in which the first player can force a win, and a losing state is one in which the second player can force a win. All games are finite and predictable so all states are one of the two.

A losing state is one in which there are moves only to winning states. A winning state has a move to a losing state. We first consider only states with Fibonacci sum for clarity

enter image description here

We can see that the losing states form a band in the middle of each Fibonacci diagonal, and this pattern necessarily repeats forever:

enter image description here

Also you can see from the same diagram that all states in the triangular region above the losing segment are also losing, because they have no move to a losing state either. And, furthermore these triangular areas are the only losing cells.