Game-Life

 view release on metacpan or  search on metacpan

Life.pm  view on Meta::CPAN

	    }
	    print "\n\n";
	    $game->process();
	}

=head1 DESCRIPTION

Conway's Game of Life is a basic example of finding 'living' patterns
in rather basic rulesets (see B<NOTES>).  The Game of Life takes
place on a 2-D rectangular grid, with each grid point being either
alive or dead.  If a living grid point has 2 or 3 neighbors within the
surrounding 8 points, the point will remain alive in the next
generation; any fewer or more will kill it.  A dead grid point will
become alive if there are exactly 3 living neighbors to it.  With
these simple rules, fascinating structures such as gliders that move
across the grid, glider guns that generate these gliders, XOR gates,
and others have been found.

This module simply provides a way to simulate the Game of Life in Perl.

In terms of coordinate systems as used in C<place_points>, C<toggle_point>
and other functions, the first coodinate is the vertical direction, 0
being the top of the board, and the second is the horizontal direaction,
0 being the left side of the board.  Thus, toggling the point of (3,2) 

Life.pm  view on Meta::CPAN

reference to an array of arrays; this array is placed into the Life
grid at the specified position, overwriting any data already there.
Within the array of arrays, any non-zero values will be considered as
a living square.

=item C<place_text_points>

Takes two scalars (indicated the position on the grid), a character,
and an array of strings; as with C<place_points>, this array will
be placed into the grid at the specified position.  The character indicates
what cells are to be considered as alive; any other character in the 
string will be considered dead.  Thus, the example given in the B<SYNOPSIS>
can be writen optionally as

	my @starting = qw( XXX
                           X..
                           .X. );

	$game->place_text_points( 10, 10, 'X', @starting );

Note that a implicit method of serialization can be used in conjunction with



( run in 1.597 second using v1.01-cache-2.11-cpan-39bf76dae61 )