# Game: two pots with coins

Rules of the game with two players.

First player puts any number of coins in the first pot. Then second player, knowing that number, puts any amount of coins in the second pot.

Then they in turns (beginning with the first player) do one of these things: take any amount of coins from one pot OR take equal amount from both pots. Whoever cannot take a coin loses. Players always know how many coins there are in the pots.

Who wins and what is the perfect strategy?

I managed to solve it, but the solution is very complicated and is based on fact which I just randomly guessed, but cannot deduct without the full solution. So I am looking for a nice approach to this problem.

The easy part is determining that player two wins: if there is a smallest winning initial donation by the first player, then the first move of player one cannot be taking just from the second pot, and this fact leads to infinite count of winning positions for player two for bounded number in the first pot, which is impossible (since there cannot be two winning positions for player two with the same amount of coins in the first pot). • @SergeSeredenko: You don't have to compute all winning positions -- you can intersect the three lines that represent the available strategies with the lines $m=\phi n$ and $n=\phi m$, and then you only need $O(1)$ operations to find the winning positions near the intersections. – joriki Mar 31 '16 at 18:54