First let us recall the two games which were introduced previously:
So the second player wins. A thorough analysis of this game is more complex, so we will accomplish this step-by-step. ![]() Sum of Two Games Suppose G and H are any two games. We define the sum G + H to be the ‘combined game‘ of G and H. To put it explicitly, we place the two games side-by-side, and let players A and B begin. At each player‘s turn, he or she may choose a valid move from either G or H. A player is not compelled to choose from a particular game; nor does he have to follow his opponent. The player who is unable to make any move at all loses. The follow diagram is an example of a sum between a game of Chinese Chess and a game of International Chess. Player A has made 3 moves on the left and 3 moves on the right, while Player B has made 5 moves on the left but 1 move on the right. However in this case, it is not clear how to determine the winner. ![]() It is clear that the sum of two Nim games is yet another Nim game. For example, the sum of the Nim games (2,5,7) and (3,4,8) is precisely the game (2,3,4,5,7,8). Also, every Nim game can be broken down as a sum of Nim games with a single pile. For example, the Nim game (2,5,7) is the sum of the individual Nim games (2), (5) and (7). Similarly, Nim-Square is simply the sum of individual games of Squaring the Number. ![]() Nimbers Nimbers are simply ‘Nim values‘ which are assigned to a game configuration - these values are written as 0, *1, *2, *3 .... We shall first describe how to obtain the Nim values for the game Squaring the Number. First, the Nim value of n=0 is assigned 0, since it is a state in which neither player has a valid move.
We then recursively adopt the following rule for each n : find all the possible moves from n and pick the smallest Nim value which does not occur among all these possible moves. Hence, the Nim value of n=1 is assigned the Nim value of *1. To illustrate the above rule, let us suppose the Nim values of all n < 13 has already been obtained :
To compute the Nim value for n = 13, let us look at the possible moves : we can subtract 1,4, or 9, which would leave n = 12, 9, or 4 respectively. These results have Nim values of 0, *2 and *2. Hence the smallest Nim value which does not occur in all these moves is *1. Now comes an important theorem in combinatorial game theory :
First things first : we mentioned equivalent games in the above theorem. What does it really mean for two games to be equivalent? This would be covered in further detail on subsequent lessons. For now, we shall illustrate what the above theorem means by solving Nim-Square thoroughly. ![]() The best way to see the result is to actually play a game. We have the following Nim values for Squaring the Number.
Consider the game of Nim-Square which starts with (18, 26, 28). The Nim values for n=18, 26 and 28 are *1, *2 and *4. Thus, this is equivalent to game of Nim which starts with (1, 2, 4). We shall analyze one particular game between players A and B. Take note of the corresponding Nim values.
The game has not ended yet, but we can see how it‘s going to proceed. At each turn, A looks at the corresponding Nim game, finds the winning move (to a losing position) there, and makes the corresponding move in his game. Notice that unlike the actual game of Nim, the Nim values in this case may bob up and down. However, B cannot postpone his defeat indefinitely by increasing the Nim values - since this is a finite game, he‘s eventually forced to decrease a Nim value. ![]() Kayles Let us look at another game : Kayles. Some rows of skittles are drawn, and each player, upon his turn, knocks down any one skittle or two neighbouring skittles. Such a game for (3,4,3) may proceed as follows: ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Hence the first player A wins. In order to analyze the game, let us assign a Nim value to a game of Kayles with n contiguous skittles. Clearly, when n=0 the Nim value is 0; and when n=1, the Nim value is *1. To compute the Nim value for n=2, note that a move may leave either 0 or 1 skittles (with Nim scores 0 or *1). Hence, the value is *2. Computing the Nim value for n=3 is a bit tricky. A move may leave either 1 skittle, 2 contiguous skittles, or 2 separated skittles. These have Nim scores *1, *2 or *(1 * 1) = 0 respectively. Hence the desired value, being the smallest non-negative integer which does not occur among all the moves, must be *3. Similarly, when n=4, the first move leaves (3), (1,2), (2) or (1,1). The Nim values of these results are *3, *(1 * 2) = *3, *2, *(1 * 1) = 0. Hence, the Nim value is *1. When n=5, the first move leaves (4), (3,1), (2,2), (3) or (2,1), whose Nim values are respectively *1, *(3 * 1) = *2, *(2 * 2) = 0, *3, *(2 * 1) = *3. Hence, the Nim score is *4. Continuing in this manner, we obtain the following table:
Hence our game configuration (3,4,3) as shown above has a Nim score of (*3, *1, *3), which in turn has a combined score of *(3 * 1 * 3) = *1. In other words, the first player wins. ![]() Grundy‘s Game A heap of n stones is given. Two players alternately split the heap into two smaller heaps of different sizes. Eventually, the heap has 1 or 2 stones left and the player who is unable to perform the split loses. When n = 1 or 2, the Nim value is obviously 0. For n=3, the only legal move is (1,2), which has a Nim value of (0, 0) = 0. Hence, the Nim value for n=3 is *1. For n=4, the only legal move is (1,3), which has a Nim value of (0, *1) = *1. Hence the Nim value for n=4 is 0. For n=5, we have two possible moves: (1,4), (2,3), with Nim values (0, 0) = 0, (0, *1) = *1 respectively. Hence the Nim value for n=5 is *2. Continuing in this manner, we have the following table:
![]() More Games Here are some other games which you may analyze for yourself:
![]() |
|