This project is inspired by the aggregation behavior of
slime-mold cells. It shows how creatures can aggregate
into clusters using a very decentralized strategy, without 
any "leader" involved.

In this example, each creature drops a chemical pheromone
(shown in green). The creatures also "sniff" ahead, trying 
to follow the gradient of the chemical. Meanwhile, the
patches diffuse and evaporate the chemical. Following these 
simple, decentralized rules, the creatures aggregate into 
Click the SETUP button to set up a collection of slime-mold
cells. Click the GO button to start the simulation.

The NUMBER slider controls the number of slime mold cells.
Changes in the slider do not have any effect until the next 
SETUP command.

The next 3 sliders affect the way turtles move. Changes to them 
will immediately affect the model run.

SNIFF-THRESHHOLD -- Turtles only look for chemical gradients if 
there is sufficient (greater than sniff-threshhold) chemical where 
they are.  Otherwise, if there is not enough chemical concentration 
in the turtle's patch, the turtle moves randomly. This parameter enables
slime mold cells to aggregate when there are enough other cells nearby. The 
default value is 1.0.

NOSE-ANGLE -- This value is the amount turtles turn to the left 
and right to check for greater chemical concentrations. The default value is 45.

WIGGLE-ANGLE -- This controls the variation in the randomness of turtle movement. When set to zero, the turtles remain at the same heading unless they are following the chemical gradient.
The default value is 40. 

BIAS -- Turtle movement is randomized. When BIAS is zero, the 
average turtle movement is straight ahead. When BIAS > 0, turtles 
will tend to move more left than right. The default value is 0.

There are several other critical parameters of the model that are 
not accessible via sliders. They can be changed by modifying the 
code in the procedures window.  Amongst these are:

the evaporation rate of the chemical -- set to .9
the diffusion rate of the chemical -- set to 1
the amount of chemical deposited at each step -- set to 2

With 100 creatures, not much happens. The creatures wander
around, dropping chemical. But the chemical evaporates and
diffuses fairly quickly, and the creatures do not aggregate.

With 500 creatures, following the exact same rules, the
result is qualitatively different. When a few creatures
happen (by chance) to wander near one another, they create 
a "puddle" of chemical. The creatures sniff the chemical and
try to stay nearby. They then deposit more chemical in the 
puddle, so the puddle expands and attracts more creatures.
This process is a good example of positive feedback: the
more creatures, the larger the puddle, and the larger the
puddle, the more likely it is to attract more creatures.

Try different values for the SNIFF-THRESHHOLD, NOSE-ANGLE, WIGGLE-ANGLE and
BIAS sliders. How do they affect the turtles' movement, gradient following and 
the formation of clumps? 

Change the NOSE-ANGLE slider after some clumps have formed. 
What happens to the clumps?

Modify the program so that the creatures aggregate into 
a single large cluster more quickly.

How do the results change if there is more (or less)
randomness in the creatures' motion?

What "critical number" of creatures is needed for the
clusters to form? How does the critical number change if you
modify the evaporation or diffusion rate?

Can you find an algorithm that will let you plot the number of distinct 
clumps over time?

In the uphill-slime procedure, the turtle "follows the gradient"
of the chemical. That is, it "sniffs" in three directions, 
then turns in the direction where the chemical is strongest.
The uphill-slime procedure can be useful in many other projects.
You might want to try variants of the uphill-slime procedure,
changing the number and placement of "turtle sniffs."

This model was adapted from the MIT Media Lab slime 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.