Game-Life-Infinite-Board
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Game/Life/Infinite/Board.pm view on Meta::CPAN
} else {
return;
};
};
sub getColor {
my $self = shift;
return $self->{'color'};
};
sub updateCell {
# Update the state of a cell. If non-existing, create it.
my ( $self, $xpos, $ypos, $state ) = @_;
defined ($self->{'cells'}->{$xpos, $ypos}) or &createCell($self, $xpos, $ypos);
if (($self->{'cells'}->{$xpos, $ypos}->{'state'}) and (not $state)) {
my $oldstate = $self->{'cells'}->{$xpos, $ypos}->{'state'};
--$self->{'liveCells'};
# Update neighbours counts:
foreach my $xx ($xpos-1 .. $xpos+1) {
foreach my $yy ($ypos-1 .. $ypos+1) {
if (($xx == $xpos) and ($yy == $ypos)) {
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.165 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )