Related Articles
Some Tricks to solve problems on Impartial games
• Difficulty Level : Easy
• Last Updated : 05 Apr, 2019

How to solve problems that fall in the Finders keepers category in ‘Game Theory’?

Note- Finders keepers game fall into the category of ‘Impartial Games’ in ‘Game Theory’.

What are ‘Impartial Games’?

Let a game is being played between two players ‘A’ and ‘B’. A game between them is said to be ‘Impartial’ if both the players have same set of moves. Which move to choose at a particular moment of the game depends on the state of the game.

FINDERS KEEPERS GAME

Let two players A and B playing a game on a pile of coins. Each player has to remove a minimum of ‘a’ coins or maximum of ‘b’ coins from the pile in his turn until there are less than ‘a’ coins left.

Types:

1. Finder-Winner -> In this format the player to play the last move wins.
2. Keeper-Loser -> In this format the player to play the last move loses.

STRATEGIES

Note- If there are less than ‘a’ coins available then last player to move must pick all coins.

1. FINDER-WINNER: Let ‘A’ be the player to start. For a game of FINDER-WINNER the main strategy is to reduce the present number coins to a multiple (a+b) for ‘A’ to win the game. Else he loses and ‘B’ wins.
2. KEEPER-LOSER: Let ‘A’ starts the game. For ‘A’ to win the game the main condition for winning it is to reduce the pile of coins to – (a+b)k + [1, a], i.e. the number of coins can be reduced to more then a multiple of (a+b) by [1 upto a]. If he can do so he wins else ‘B’ wins.

Examples:

1. Let A and B play a game of FINDER-WINNER on a set of 20 coins. A player in his move can remove a minimum of 5 coins and a maximum of 7 coins. predict the Winner of the Game If A starts first and if both players play optimally.

Given number of coins = 20.
Minimum coins that can be removed = 5 – Let it be ‘a’.
Maximum coins that can be removed = 7 – Let it be ‘b’.

According to given strategy for FINDER-WINNER:

For A to win: A must remove the number of coins to a multiple of (a + b). Nearest multiple of (a + b) for 20 is 12. So A can deduct either 5 or 6 or 7 coins from the set so he cant reach 12 anyhow. So for B to make a move, he will be left with 15 or 14 or 13 coins. Now for A’s next move corresponding states are (10, 9, 8), (9, 8, 7) and (8, 7, 6). Since B is also playing optimally he will keep the number of coins for A’s move greater than 7 so that A cant win. Hence, he will get at least 1 coin to be removed in the last move and WIN.

2. Let A and B play a game of Keeper-Loser on a set of 20 coins. A player in his move can remove a minimum of 2 coins and a maximum of 5 coins. Predict the Winner of the Game If A starts first and if both players play optimally.

Given number of coins = 20.
Minimum coins that can be removed = 2 – Let it be ‘a’.
Maximum coins that can be removed = 5 – Let it be ‘b’.

According to given strategy for KEEPER-LOSER :

For A to win: A must remove the number of coins to a multiple of (a + b)k + [1, a]. Here a + b = 7.
Now, for playing optimally lets see what A will do in further rounds. If A reduces the set of coins to lets say 15 which is of the form (2 + 5) * 2 + 1 as it is reachable by removing 5 coins from a set of 20 coins. From here B can take any number of coins from [2, 5] lets name it as c. The main strategy of A now will be to remove 7 – c in his moves.

Why is it so?

Lets say after 15, B reduces the set to 10 by taking away 5 coins. Now optimal strategy for A is to remove 2 coins. If he does so, the set reduces to 8 coins. Now from here B can reduce the set to (6, 5, 4, 3) by removing (2, 3, 4, 5) coins respectively. From here again, the main idea for A is to take away 7 – c coins which will keep 1 coin for B to remove. Hence A wins.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

In case you wish to attend live classes with industry experts, please refer Geeks Classes Live and Geeks Classes Live USA

My Personal Notes arrow_drop_up