View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Salvador Fandiño García > AI-Termites-0.02 >


Annotate this POD

View/Report Bugs

NAME ^ - Artificial Termites



This script runs the Artificial Termites simulation provided by the Perl module AI::Termites.

The accepted options are as follows:

--dim N

Number of dimensions of the world. Defaults to 2.

--world-size SIZE

The size of the world box, Defaults to 1.

--specie NAME

The name of the artificial termite subspecie to simulate.

The currently accepted ones are LoginquitasPostulo, NemusNidor, VicinusOcurro and PeractioBaro.

--wood N

Piezes of wood in the simulated world.

--termites N

Number of termites in the simulated world.

--near SIZE

The size of the boll that a termite will consider as its neighborhood. Defaults to 1/50 of the world size.

Every specie uses this parameter in a different way.


Represent on the drawings the pieces of wood that are actually being moved by some termite.

--output FILENAME

Prefix used for the file names of the generated PNGs. Defaults to output.

--one-of N

Save to file one of every N frames. Defaults to 5.

--top N

Exit the application when the number of iterations reachs the given number.

--width W

Number of pixels of the generated images. Defaults to 1024.


Generate TrueColor PNGs.

The default PNG format uses a 8bit indexed palette that is not correctly handled by some programs as ffmpeg or mencoder.

EXAMPLES ^ --specie=VicinusOccurro --truecolor --output vo --one-of 1 --top 10000 --specie=PeractioBaro --one-of 10 --near 0.02 --taken --dim 2 \
              --truecolor --output pb --top 40000


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

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


The idea about artificial termites comes from the book "Adventures in Modeling" by Vanessa Stevens Colella, Eric Klopfer and Mitchel Resnick (

An online Artificial Termites simulation can be found here:

The origin of this module lies on the following PerlMonks post:


Copyright (C) 2011 by Salvador Fandiño, <>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: