This project is inspired by the behavior of termites
gathering wood chips into piles. The termites follow a 
set of simple rules. Each termite starts wandering randomly.
If it bumps into a wood chip, it picks the chip up, and
continues to wander randomly. When it bumps into another
wood chip, it finds a nearby empty space and puts its wood 
chip down.  With these simple rules, the wood chips eventually end up in a single pile.

Click the SETUP button to set up the termites (red) and
wood chips (yellow). Click the GO button to start the 
simulation.  The termites turn orange when they are carrying a wood chip.

The NUMBER slider controls the number of termites. (Note:
Changes in the NUMBER slider do not take effect until the
next setup.) The DENSITY slider controls the initial density
of wood chips.  The SIM-DELAY slider can be used to slow down 
the speed of the simulation.

As piles of wood chips begin to form, the piles are not
"protected" in any way. That is, termites sometimes take 
chips away from existing piles. That strategy might seem
counter-productive. But if the piles were "protected", you
would end up with lots of little piles, not one big one.

The final piles are roughly rounds.  Why is this?  What other physical situations also produce round things?  

In general, the number of piles decreases with time. Why?
Some piles disappear, when termites carry away all of 
the chips. And there is no way to start a new pile from
scratch, since termites always put their wood chips near 
other wood chips. So the number of piles must decrease over
time. (The only way a "new" pile starts is when an existing
pile splits into two.)

This project is a good example of a DECENTRALIZED strategy.
There is no termite in charge, and no special pre-designated
site for the piles. Each termite follows a set of simple
rules, but the colony as a whole accomplishes a rather 
sophisticated task.

Do the results change if you use just a single termite?
What if you use several thousand termites?

When there are just two piles left, which of them is most
likely to "win" as the single, final pile? How often does 
the larger of the two piles win? If one pile has only a 
single wood chip, and the other pile has the rest of the 
wood chips, what are the chances that the first pile will 

Can you extend the model to have the termites sort several colors of wood?   

Plot the number of piles, or their average size, or the number of termites carrying wood chips, as the model runs.  

Notice that the wood chips do not exist as objects. They are
just represented as colors in the patches. The termites
update the patch colors as they pick up and put down the
wood chips. In effect, the screen is being used as the data 
structure. This strategy is useful in many StarLogoT

Painted Desert Challenge

This model was adapted from the MIT Media Lab termites model. See Resnick, M. (1994) "Turtles, Termites and Traffic Jams: Explorations in Massively Parallel Microworlds." Cambridge, Ma: MIT Press. Adapted to StarLogoT, 1997, as part of the Connected Mathematics Project.