Nim Game
en.wikipedia.org
Nim Game
1–10 of 11 posts
Re: Nim Game
#2Re: Nim Game
#3Re: Nim Game
#4Re: Nim Game
#5https://combinatorialgametheory.blogspot.com
Kyle also keeps a pretty nice table of combinatorial games (and their properties) updated as new ones come his way:
http://turing.plymouth.edu/~kgb1013/rulesetTable.php
A lot of this is over my head, but I still find it interesting (and play a few games on the list).
I've been meaning to ask him about Hive, because it fits the mold, but isn't present.
Re: Nim Game
#6Re: Nim Game
#7Re: Nim Game
#8I make all my beginning programming students code Nim as an assignment about halfway through the year. http://programmingbydoing.com/a/nim.html
Re: Nim Game
#9I got a lot of milage out of Nim. In my first public technical presentation, I taught this to a classroom full of math-interested kids in a school district wide weekend event when I was 15 years old; and for my EE degree I used it as the basis of my semester project in Digital Design Lab. I build a Nim playing system out of NOR gates and flip-flops.
Perfect strategy for Nim is achieved by maintaining a simple invariant (call it even Nim parity) when it is your opponent's turn to move. At each turn, make a move that puts the game back into even Nim parity before your opponents turn. To compute even Nim parity, represent the number of counters/tokens in each pile in binary then xor together these binary values bit-wise.
For example with piles of 3, 5, and 7 tokens, the binary values are 11, 101, and 111, and the xor(011, 101, 111) == 001. This tells us that we have to make a move that changes the right-most bit position only so remove one token from any pile. This leaves the opponent in a position from which any move they make it is possible to respond in a way that puts the game back into even Nim parity. Eventually they lose, but your very last move will depend upon whether you are playing to win by taking the last piece or forcing your opponent to take the last piece.
Martin Gardner's column is, of course, much clearer than my explanation. In particular, he explains the a method of using ones fingers to keep the parity counts so that by just keeping one hand under the table and using the left pinky finger for rightmost (1's) bit position and ring finger for next (2's) bit position, etc. it is possible to play perfect strategy very rapidly.