Picking up Stones 1 - JavaLab

Picking up Stones 1

Pick up the stones each other. The person who picks up the last one is lost the game. You can not pick up more than three at a time.

The computer thinks like this:
Whenever I pick up 1, 2, 3, if the opponent picks up 3, 2, 1, the stone decreases by four each time.
Therefore, if the number of stones remaining is 4n+1 (n is a random integer), the opponent will have one last.