version 1.00 (21 May 1994)
LoseNIM is a package containing the ANSI C source code for the
game losenim
, which allows the user to lose the game of
NIM reliably (I claim). Actually, I recently learned that I had it
backwards: I thought the player who takes the last stone loses, but
that's called misère NIM.
LoseNIM100.tar.gz is an archive of the package itself.
Here's a sample run:
Welcome to LoseNIM 1.00 by Adam M. Costello <amc@cs.wustl.edu>. The generalized game of NIM starts with some piles of stones. Two players take turns choosing a non-empty pile and removing some non-zero number of stones from that pile. The player who removes the last stone loses. In this game, you will decide the initial configuration of the stones, and I will decide who goes first. I will win. Enter a 0-terminated, whitespace-separated list of positive integers indicating the number of stones initially in each pile. 3 5 7 0 I will go first. The configuration is now: 3 5 7 I take 1 stone from a pile of 3. The configuration is now: 2 5 7 From which pile do you wish to remove stones? 7 How many stones do you wish to remove? 7 The configuration is now: 2 5 0 I take 3 stones from a pile of 5. The configuration is now: 2 2 0 From which pile do you wish to remove stones? 2 How many stones do you wish to remove? 1 The configuration is now: 1 2 0 I take 2 stones from a pile of 2. The configuration is now: 1 0 0 From which pile do you wish to remove stones? 1 How many stones do you wish to remove? 1 The configuration is now: 0 0 0 You took the last stone. I win.
|