Some Tricks to solve problems on Impartial games
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:
 FinderWinner > In this format the player to play the last move wins.
 KeeperLoser > 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.
 FINDERWINNER: Let ‘A’ be the player to start. For a game of FINDERWINNER 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.
 KEEPERLOSER: 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:

Let A and B play a game of FINDERWINNER 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 FINDERWINNER:
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.

Let A and B play a game of KeeperLoser 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 KEEPERLOSER :
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.
Recommended Posts:
 Program to solve the Alligation Problem
 Solve the Linear Equation of Single Variable
 Gaussian Elimination to Solve Linear Equations
 RungeKutta 4th Order Method to Solve Differential Equation
 Problems not solved at the end of Nth day
 Recursive Practice Problems with Solutions
 Interactive Problems in Competitive Programming
 Number of K length subsequences with minimum sum
 Check whether the given integers a, b, c and d are in proportion
 Count of matchsticks required to represent the given number
 Count number of ways to arrange first N numbers
 Probability that a random pair chosen from an array (a[i], a[j]) has the maximum sum
 Number of triangles that can be formed
 Find the deleted value from the array when average of original elements is given
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.