|
NIM - mathematical games |
NIM - mathematical games
use Games::NIM;
$game = new Games::NIM; $game->play();
Currently you can only play on the command line with the built in interface. Send your feedback so I now how to improve.
In all the games there are several groups of something, let's call them stones. There are 2 players who take away a few stones on every turn according to some rules. They always have to take away at leas one stone. The winner is eihter the one who takes the last stone, or the other player :) depending on the game.
k is defined when we start the game.
The winner is who takes the last stone.
Each player can take a few stones at a time where the possible numbers are listed at the beginning of the game. The list can contain any of the values between 1 and n E.g. it can be only 3 or 3 and 7, or ...
The winner is who takes the last stone.
Special cases are: (k, k+1) (1, k) (k, q)
result:
oooooo ooo ooo oo
The game ends when there are no more chocolate The winner is who remains without chocolate. (The one who takes the last chocolate loses)
Gabor Szabo <gabor@tracert.com>
The NIM module is Copyright (c) 2001 Gabor Szabo. Israel All rights reserved.
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
Dr. Zoltan Dienes for his book
|
NIM - mathematical games |