AI-Termites

 view release on metacpan or  search on metacpan

samples/termites.pl  view on Meta::CPAN

        else {
            $im->filledEllipse(scl($wood->{pos}), 5, 5, $blue);
        }
    }

    for my $ter (@{$ters->{termites}}) {
        my $color = (defined($ter->{wood_ix}) ? $red : $green);
        $im->filledEllipse(scl($ter->{pos}), 3, 3, $color);
    }

    my $name = sprintf "%s-%05d.png", $output, $fn;
    open my $fh, ">", $name;
    print $fh $im->png;
    close $fh;

    print "$n ($fn)\r";
    for (1..$one_of) {
        $n++;
        $ters->iterate;
    }
    $fn++;
    last if ($top and $n > $top);
}

samples/termites.pl  view on Meta::CPAN

  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/>).

An online Artificial Termites simulation can be found here:
L<http://www.permutationcity.co.uk/alife/termites.html>.



( run in 0.591 second using v1.01-cache-2.11-cpan-df04353d9ac )