When analyzing a finite combinatorial game, the two key questions are:
1) Who wins, if both players play optimally?
2) What playing strategy is "optimal"?
That is, given the current state (or "position") of the game, the question is whether the player whose turn it is to move can force a win, and if so, what move(s) must be made to do so. Some famous combinatorial games whose strategies have been studied extensively include chess, nim, and tic tac toe.
The problem-solving technique that is often useful in this context is inductive reasoning. In other words, start by analyzing simple versions of the game to build up an understanding of who wins in which positions, at which point the result can be extended to the full game. Here is a basic example.
In a two-player game, starting with a pile of stones, the players take turns choosing to remove either or stones from the pile. The winner is the player who takes the last stone from the pile. For which can the second player guarantee that he or she will win?
Solution: Begin by looking at small cases. If the pile contains stones, then the first player wins immediately by taking them all. But if the pile contains stones, the second player can win, because after the first player removes some stones, the second player can remove the rest.
But if there are or stones, the first player can win by leaving , since is a losing position for the player whose move it is. Here we are inductively building on our knowledge of earlier positions. Similarly, is a win for the second player.
Often at this point it is easiest to make an educated guess at the general situation, and then to explain why the guess is true (since the reasoning is inductive, the proof often uses induction as well). Here the correct claim appears to be that multiples of are wins for the second player, and everything else is a win for the first player. This can be proved by induction. The base case is done already. Now suppose the claim is true for . For the first player wins by taking respectively, and for the first player cannot help but leave or , which are wins for the player whose turn it is. So the claim is true for , which establishes the inductive step.
To further check your understanding, consider this example which is an extension of the example in the introduction:
In a game, Bob goes first, and he has to say a positive integer less than or equal to 16.
Then, Allison must add a positive integer less than or equal to 16 to Bob’s number, at which point Bob must add a positive integer less than or equal to 16, and so on. The winner is whomever says the number 2015.
What number must Bob say first to ensure that he will win the game if both players play optimally?
With the above examples in mind, we can use the following 3 rules to classify all positions as winning or losing, depending on whether the player to move will ultimately win or lose with perfect play on both sides.
- The empty game (the game where there are no moves to be made) is a losing position.
- A position is a winning position if at least one of the positions that can be obtained from this position by a single move is a losing position.
- A position is a losing position if every position that can be obtained from this position by a single move is a winning position.
Due to the deterministic nature of the game, one can show via backward induction that every position can be uniquely characterized as a winning or a losing position. Rule 2 also tells us, in general terms, how to move optimally when we are at a winning position: we move to a position that is a losing position. As such, this provides us with a very simple algorithm to understand how these games are played:
Problem-solving strategy for combinatorial games:
1. Analyze simple starting positions, to build a library of basic winning and losing positions.
2. Conjecture a general description of winning and losing positions, based on the examples.
3. Prove the conjecture (often by induction): show that a winning position can always move to a losing position, and that a losing position can only move to a winning position.
Here is another example which uses this terminology and strategy.
A two player game is played on a grid. A token starts in the bottom left corner of the grid. On each turn, a player can move the token one or two units to the right, or to the leftmost square of the above row. The last player who is able to move wins. Determine which positions of the token are winning positions and which are losing.
Solution: It is easy to determine the winning and losing positions for the top row, since the only options are to move 1 or 2 positions to the right. This gives the top row of W L W W L. Since the first position in the row is a winning position, it is never advantageous to move up here from the previous row. This means that the last position in the next row is also losing, and the whole row will have the same pattern as this row. The pattern will continue for all 5 rows, so if the token is in the or column, it is a winning position, and if it is in the or column, it is losing.
Bonus: Generalize this problem to larger grids. How many winning positions are there on a grid?
Dan and Sam play a game in which the first to start says the number 1, the next says 2, and the one who's next must say an integer strictly between the previous number and twice of it (not including the endpoints).
For example, Dan begins saying 1, then Sam says 2. Dan's options are now all integers between 2 and 4, exclusive. But there's only one such option, 3, so Dan is forced to say 3. Sam's options are now between 3 and 6, which are 4 and 5.
The game finishes when someone says 100 or greater; that player wins.
If Dan begins, who will win, assuming both players play optimally?
This is the first problem of the set Winning Strategies.
You take these nine cards out of a standard deck (ace through 9 of hearts), put them all face up on a table and play the following game against another player:
Both players take turns choosing a card. The first player to have three cards that add up to 15 wins. The ace counts as one.
If both players play optimally, which player has a winning strategy?
You play a game with a pile of gold coins.
You and a friend take turns removing 1, 3, or 6 coins from the pile.
The winner is the one who takes the last coin.
For the person that goes first, how many winning strategies are there for
Clarification: For , for how many values of can the first player develop a winning strategy?
Chomp is an impartial combinatorial game whose rules are as follows: A rectangular chocolate bar (where ) is cut into squares. Alice and Bob take turns eating the bar from the top right: they pick a square and eat it along with all the squares above and to the right of it (including the squares directly above and directly to the right). Each player must eat at least one square at each turn. The person who eats the lower left square loses.
Case 1: Chomp with one row.
Alice (the first player) wins by eating all but the lower left square.
Case 2: Chomp with two rows.
Denote a two-row bar in the middle of a Chomp game by where is the number of squares in the top row and the number of squares in the bottom row. So . The claim is that the losing positions are precisely .
To see that is losing, we proceed by induction. It's easy to see that (or ) is losing. Now suppose Alice must move from . She has two options. If she bites just the top row, to reduce to , Bob can reduce to which is losing for Alice by induction. If she bites both rows to reduce to a rectangle , Bob can reduce to , which is losing for Alice by induction.
It's clear that these are the only losing positions: if Alice moves from any other position, she can bite the bar to reduce to , so Alice wins. So in particular, starting from a two-row rectangle, Alice wins by eating the top right square only.
Case 3: Chomp with three (or more) rows.
Even three-rowed Chomp is a complex problem, the subject of contemporary research. The best first move for Alice (as a function of the number of columns) is not obvious, but it turns out to be easier to prove that Alice must always win for any nontrivial rectangular starting shape.
It can be proved that Chomp is always a win for the first player under optimal play, even though the general game strategy is unknown.
To show this, suppose a certain rectangular bar is a win for the second player, Bob. Then if Alice starts by eating just the top right corner, Bob must have a devastating move that leaves Alice a losing position. But Alice could have made that move instead at her first turn, which would leave Bob that same losing position. This is a contradiction.
This is a textbook example of a nonconstructive proof: it is clear that the first player must win, but the proof gives almost no insight into the correct winning move (or moves).
Let be a positive integer. Alice and Bob play the following divisor game: starting with the set of positive divisors of , the players take turns removing some elements from the set. At a player's turn, he or she chooses a divisor that remains, and removes and any of the divisors of that remain. The player who moves last loses.
For example: . Alice chooses , so she removes and . The remaining set is . Bob chooses and so must also remove . The remaining set is . Alice takes , and now Bob is forced to take , so he loses.
Let be the largest positive integer such that if Alice and Bob play the divisor game for and both of them play optimally, the second player wins. Find . If no such exists, enter .