# Answer to Question #53507 in C++ for bara

Question #53507

Alice and Bob are playing a game called "Stone Game". Stone game is a two-player game. Let N be the total number of stones. In each turn, a player can remove 1, 2 or 3 stones. The player who picks the last stone, loses. They follow the "Ladies First" norm. Hence Alice is always the one to make the first move. Your task is to find out whether Alice can win, if both play the game optimally.

Expert's answer

Answer

Start By Considering the base cases:

• First for n=1, Obviously Alice Loses.

• For n = 2,3,4 Alice Wins.

• For n = 5, Bob Wins.

Now for further 3 positions (i.e. 6,7,8), we can make Alice reach Bob's Winning position but starting from Bob ( i.e. (6-1), (7-2), (8-3) ). Then, Bob can only return Alice her winning positions.

• So, Alice Wins for n = 6,7,8.

Similarly for n= 9 Bob Wins. Continuing this reasoning, we can say that for n=1,5,9 i.e for any number of form 4n-3, Bob wins and for the rest, Alice wins.

Start By Considering the base cases:

• First for n=1, Obviously Alice Loses.

• For n = 2,3,4 Alice Wins.

• For n = 5, Bob Wins.

Now for further 3 positions (i.e. 6,7,8), we can make Alice reach Bob's Winning position but starting from Bob ( i.e. (6-1), (7-2), (8-3) ). Then, Bob can only return Alice her winning positions.

• So, Alice Wins for n = 6,7,8.

Similarly for n= 9 Bob Wins. Continuing this reasoning, we can say that for n=1,5,9 i.e for any number of form 4n-3, Bob wins and for the rest, Alice wins.

## Comments

## Leave a comment