NAME

Games::Chomp - Playing Chomp and calculating winning positions

SYNOPSIS

use Games::Chomp;
my $chomp = new Games::Chomp;
$chomp->run;

DESCRIPTION

Chomp is the name of a mathematical table game with 
finate number of positions. Though it is easily proven 
that the one who moves first has a winning strategy
there is no mathematical function that will calculate
the next winning move from any given position.

This module provides an algorithm to programatically 
calculate the winning moves for any given position.

The current implementation has some O(n**4) (?) complexity
so it is not a good one but this is the first version after
all.

THE RULES

There is a chocolate of n*m cubes.
The upper left cube is poisoned. Two people are eating the
chocolate (at least one cube at a time) and whoever eats the 
poisoned chocolate looses.

Eating the chocolate is done by pointing at one of the existing 
cubes eating it and everything to the right and below it.

Examples:
In the following case 
z - is the poisoned cube.
o - is a regular cube
x - is where the player points

Beginning: a chocolate with 4 rows and 6 cubes in every row.
zooooo
oooooo
oooooo
oooooo

player 1 points at row 2 cube 4

zooooo
oooxoo
oooooo
oooooo

result:

zooooo
ooo
ooo
ooo


player 2 points at row 3 cube 2

zooooo
ooo
oxo
ooo

result:

zooooo
ooo
o
o

player 1 points at row 1 cube 2

zxoooo
ooo
o
o

z
o
o
o

player 2 points at row 2 cube 1

z
x
o
o

result:

z

player 1 has to eat the poisoned cube so s/he looses.

AUTHOR

Gabor Szabo <lt>gabor@tracert.com<gt>

COPYRIGHT

The Games::Chomp module is Copyright (c) 2002 Gabor Szabo.
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.

SEE ALSO

Games::NIM