AI-Termites

 view release on metacpan or  search on metacpan

lib/AI/Termites.pm  view on Meta::CPAN

    $termite->{wood_ix} = $wood_ix;
}

sub termite_leave_wood {
    my ($self, $termite) = @_;
    my $wood_ix = delete $termite->{wood_ix} //
	croak "termite can not leave wood because it is carrying nothing";
    $self->{taken}--;
    my $wood = $self->{wood}[$wood_ix];
    $wood->{taken} = 0;
    $wood->{pos}->set($termite->{pos});
}


1;
__END__

=head1 NAME

AI::Termites - Artificial termites simulation

samples/termites.pl  view on Meta::CPAN


  termites.pl --specie=VicinusOccurro --truecolor --output vo --one-of 1 --top 10000

  termites.pl --specie=PeractioBaro --one-of 10 --near 0.02 --taken --dim 2 \
              --truecolor --output pb --top 40000



=head1 MAKING MOVIES

In order to convert a set of PNGs into an animation, ffmpeg can be
used as follows:

  ffmpeg -i output-%05d.png video.mpg

=head1 SEE ALSO

The idea about artificial termites comes from the book "Adventures in
Modeling" by Vanessa Stevens Colella, Eric Klopfer and Mitchel Resnick
(L<http://education.mit.edu/starlogo/adventures/>).



( run in 0.573 second using v1.01-cache-2.11-cpan-49f99fa48dc )