I am trying to understand the Stones game stated here.
The stones game is a simple game, it is also a very old game which is unknown to almost everyone.
The game starts with N stones and M players, the players are numbered from 1 to M. The players play in turns, player number 1 plays first, then player number 2 and so on until player number M plays, after this player number 1 plays again and they keep playing until the end of the game. For each turn, the players do the following 2 steps:
The player gets a chance to remove a stone, and he/she should remove a stone in this step if he/she decided to do so.
Regardless of the decision of the current player (whether or not he/she removed a stone in the first step), if this is not the first turn and in the previous turn the player decided not to remove a stone in his/her first step, then the current player must remove a stone in this step (if in the previous turn the player decided to remove a stone in his/her first step, then the current player must not remove a stone in this step).
This means in some turns a player might remove 0, 1 or 2 stones according to the above rules. In this game, the player who removes the last stone wins the game. Now you are given the total number of stones, the total number of players and a player number and you are asked to answer the following question: Is there a strategy for this player to win the game regardless of the actions taken by the other players in their turns?
In the sample example it is also stated that 2 players are playing with 2 stones and 2nd player can win the game regardless of the actions taken by the first player. How is it possible? A player can remove either 0 or 1 or 2 stones. If the first player removes 2 stones in his first turn 2nd player will not have any stones left to play then how 2nd player will be able to win?