![]() |
![]() |
|
![]() |
![]() |
Encyclopedia :
N :
NI :
Nim |
|
|
Nim
In the normal version, the player to take the last object wins; in the misère version of the game (sometimes known as Pearls Before Swine), the player to take the last object loses. It is this version that is most commonly played in practice. In some regions, the misère version of the game is also known as last stone game. In the misère version or last stone game, the loser is forced to remove the last stone as that is the last stone left at his turn; whereas in the normal version, the winner will remove all stones in the last remaining group to win the game. Thus the normal version can be called last move game. Nim is now used as a simple illustration of the Sprague-Grundy theorem. A version of this game is played in Alain Resnais' movie L'année dernière à Marienbad. Illustration A typical normal game starts with heaps of 3, 4 and 5 objects: Summary of theoryNim has been mathematically solved for any number of initial heaps and objects; that is, there is a defined and guaranteed way to win for one of the players, be it the normal or misère game. In a typical misère game that starts with heaps of 3, 4, and 5, player 1 will win with optimal play. The key to the theory of the game is the binary digital sum of the heap sizes, that is, the sum (in binary) neglecting all carry overs. Binary digital sum shall be more formally represented by a series of exclusive-or operations. This latter term will be used in the subsequent sections in describing the theory. An equivalent procedure, which can be performed mentally, is to express the heap sizes as a sum of powerss of 2, cancel pairs of equal powers, and then add what's left: In the normal game, the strategy is finishing every move with a digital sum of 0, which is always possible if it is different from 0 (in the example above, it suffices taking 2 objects from heap A). If the digital sum is 0 and you must make a move, there is no way you can win the game (assuming the other player is a perfect player), you can only make random moves hoping to confuse your opponent. For a misère game, the strategy has to be slightly altered. To win, play the game like normal until all but one of the non-empty heaps contain a single object. Then take from the heap with multiple objects to leave an odd number of single object heaps. In a typical game (with 3 heaps of 3, 4 and 5), the strategy would be applied like this: A B C Sum (Heaps A, B, and C) 3 4 5 010 I take 2 from A, leaving a sum of 000, so I will win. 1 4 5 000 You take 2 from C 1 4 3 110 I take 2 from B 1 2 3 000 You take 1 from C 1 2 2 001 I take 1 from A 0 2 2 000 You take 1 from C This is where the alternate strategy kicks in. 0 2 1 010 I take the entire B heap, to leave an odd number (1) of single object heaps. 0 0 1 000 You take 1 from C, and lose. Trick for a set of two numbersIf Player A reduces the number set to (2, 2), there are two choices:That is to say for either choice Player B loses the game. Now the winning strategy is for Player A to find, (x, y), such that: Then naturally after Player B’s move with (x, y), Player A has the chance to reduce the number to winning moves such as (1, 1) or (2, 2). For example if (x, y) is (4, 2) then Player B can reduce to (2, 2) and Player A loses the game. It is deduced that (x, y) shall be (3, 3), which satisfies all above conditions. If Player A makes the number set to be (3, 3), the following explores all possible moves of Player B: Moves of Player B Moves of Player A Who Win (2, 3) (2, 2) Player A (2, 1) (1, 1) Player A (2) (0) Player A It has therefore been demonstrated that (3, 3) is a winning move for Player A if he can achieve this number set. By the same deduction method, similar conditions can be set to deduce a winning number set larger than (3, 3). It can be therefore induced that the following are winning moves in addition to (2, 2) and (3, 3):
Now the winning strategy is for Player A to find (x, y, z), such that: Then naturally after Player B’s move on (x, y, z), Player A has the chance to reduce the number to winning moves such as (1, 1) or (2, 2). It is deduced that (x, y, z) shall be (1, 2, 3), which satisfies the above three (3) conditions. If Player A’s move is (1, 2, 3), the following explores all possible moves of Player B: Moves of Player B Moves of Player A Who Win (1, 2, 2) (2, 2) Player A (1, 2, 1) (1, 1) Player A (1, 2) (1, 1) Player A (1, 1, 3) (1, 1) Player A (1, 3) (1, 1) Player A (2, 3) (2, 2) Player A It has therefore been demonstrated that (1, 2, 3) is a winning move for Player A. By the same deduction method, similar conditions can be set to deduce a winning number set larger than (1, 2, 3). It can be therefore induced that the following are also winning moves:
The trick is to remember the winning moves (number sets) below. To win the game, a player shall make the number set confirming to them. Restricted by reducing only one number at a time, his opponent will not have chance to bring the number set confirming to a smaller winning moves.
Winning strategy for misère versionSurprisingly, changing the rule for winning as in the misère version does not make a significant change in the winning moves. Now with the new rule, if Player A reduces the number set to (1, 1, 1) or (2, 2), Player B loses the game. Given the number set (2, 2), there are two choices for B: For both choices, Player A wins the game. These number sets (1, 1, 1) or (2, 2) are thus the basic winning number sets not dissimilar to (1, 1) and (2, 2) for the normal version of the game. It can be deduced that the next winning number set is also (1, 2, 3). In general, all winning moves for last stone game are the winning moves for last move game except that (1, 1, 1) replaces (1, 1). Theory of winning formulaHaving illustrated some of the winning tricks, the following quotes a theory by on the winning formula for normal version or last move game played with a set of three (3) numbers (x, y, z). The theory also applies to a set of more numbers.
The theory can be extended to a set of four or more numbers: Thus the trick of winning the game is to reduce a number in the set such that the new number set conforms to the winning move. Proof of the theory of winning formulaA set of two numbers such that x xor y = 0, i.e. x = y has been proven to be winning moves in one of the section above. To prove the theory of winning formula, it is necessary to prove the following theories:
:i.e. A = B xor C ... (Eqn 2) :and B = A xor C ... (Eqn 3) :and C = A xor B ... (Eqn 4) The LHS of (Eqn 2) i.e. B xor C results in a unique solution A. If A is reduced, (Eqn 2) is no more true and thus Condition 1 will no more be true. By similar reasoning, if B or C is disturbed at a time, Condition 1 will also be upset and the proof is complete. Proof of Theory 2To prove Theory 2, it is necessary to prove in two parts: Proof of Theory 2axor(A', A', A') = (A' xor A') xor A' = A' , satisfy the condition of greater than zero. The number set (A', A', A') can be reduced in one move to (A', A' ) whereby xor(A', A') = 0 thus completing the proof. (A', A' ) is indeed a winning move. Proof of Theory 2bTo prove Theory 2b, it is necessary to prove the following:
Proof of the winning theoryGiven that Player 2 starts with the number set (A, B, C) such that xor(A, B, C) = 0, Player 2 cannot make a move such that the resultant number set is (A', B', C') and xor(A', B', C') = 0 according to Theory 1. However, after his move, Player 1 can revert the situation and can always make a move to (A", B", C") such that xor(A", B", C") = 0 according to Theory 2. Thus by mathematical induction, if winning moves of (A, B, C) with small numbers satisfy xor(A, B, C) = 0, then all such possible (A, B, C) satisfying xor(A, B, C) = 0 are winning moves. The number sets (0, 1, 1), (0, 2, 2) and (0, n, n) etc are indeed winning moves. This completes the proof. Other variation of the game Another variation to Nim is restricting the maximum number of stones to be removed at each turn. This variation however simplifies the game to a very simple arithmetic and will not be illustrated here. External links and references
|
|
|
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License. |
|
| © 2008 Chamas Enterprises Inc. |