Take One, Two or Three
Two players share a pile of stones. They take turns, and on a turn a player removes 1, 2 or 3 stones. Whoever takes the last stone wins.
Both play as well as possible. Return True if the player who moves first wins, and False otherwise.
Example 1
stones 4
returns false
Whatever the first player takes, 1, 2 or 3, the second player takes the rest.
Example 2
stones 5
returns true
The first player takes 1 and leaves 4, which is a losing pile for the one to move.
Example 3
stones 3
returns true
The first player takes all three.
Constraints
1 <= stones <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.