We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The pattern emerges pretty quickly if you start from 1 stone and look at if the first player will win or lose with each stone you add.
SPOILER
You'll find that the first player will lose when the starting number of stones s is: 1,7,8,14,15,21,22... (i.e. when s % 7 < 2). With this knowledge in hand the code is trivial:
Game of Stones
You are viewing a single comment's thread. Return to all comments →
The pattern emerges pretty quickly if you start from 1 stone and look at if the first player will win or lose with each stone you add.
SPOILER
You'll find that the first player will lose when the starting number of stones s is: 1,7,8,14,15,21,22... (i.e. when s % 7 < 2). With this knowledge in hand the code is trivial: