Skip to content

Instantly share code, notes, and snippets.

@AndyMoreland
Created October 12, 2011 03:36
Show Gist options
  • Save AndyMoreland/1280198 to your computer and use it in GitHub Desktop.
Save AndyMoreland/1280198 to your computer and use it in GitHub Desktop.
Let's assume optimal strategy. If there is only one stack, then the first player to move can win if he wants to by taking all of the stones. IF both players want to lose, then the first player still wins because the second player can take all of the stones except for one that the first player leaves.
Okay, so how does this transfer to a two stack game?
The first person to make a move on the last stack remaining wins.
So basically, if you want to win, you need to lose the first stack.
As shown above, the first player always wins the first stack, regardless of his decision.
This forces him to take the second move on the last stack, which means he loses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment