In Follower, turtles attempt to "connect" with other turtles, forming long chains according to a small set of simple rules.

In the model, a turtle can follow only ONE other turtle, and similarly it can only be followed by ONE other turtle.  This means there are four turtle states, each represented by a different color:

Pink:  Unattached
Green:  Following another turtle
Yellow:  Being followed by another turtle
Blue:  Following and being followed by other turtles

Turtles are created in the pink (unattached) state.  At each turn, each turtle checks a random patch in a torus (donut) around itself.  If it finds a turtle there who is not already being followed, it will "latch on" and start following the movements of that turtle. An Unattached turtle (one that has not yet "latched on" to another turtle) will move randomly.  

SETUP: Clears the graphics window and creates the number of turtles specified in the NUMTURTLES slider.  All the turtles are created in an unattached state (pink).
GO: Runs the simulation.
NUMTURTLES: Specifies the number of turtles created in SETUP.
NEAR-RADIUS: The inner radius of the torus turtles search in.
FAR-RADIUS: The outer radius of the torus turtles search in.
WAVER: The amount of randomness in the movement of unattached turtles.

There is also a graph called "Turtle Count" that graphs, over time, the number of turtles in each state

Each of the sliders has a different effect on the simulation.  

Notice that the when the number of turtles is high (several thousand), chains tend to form very quickly.  This is because there are more turtles and therefore more chances for each turtle to attach on each turn.  

Varying the size of the donut tends to affect how the turtles start to attach, but in the long run doesn't have a big effect on the simulation outcome.  Donut size is most interesting at very small values, which causes the turtles to attach into very small circles.  Also, very large thick donuts (big FAR-RADIUS, small NEAR-RADIUS) looks interesting with a large number of turtles.

The amount of movement randomness (set by WAVER) can also change the simulation outcome.  Very high values for WAVER result in small circles being formed because the turtles are continuously moving over themselves, increasing the chances of connecting the head of the chain to its tail.

The simulation, under any parameters, moves towards forming circles.  Circles may be formed by wrapping around the screen, but in almost all cases if the simulation is left running long enough you will get many small circles or one big circle.  It is possible that a chain will never connect to itself if the WAVER slider is set to zero, but otherwise the simulation should proceed towards circles.


Try making the waver setting very high.  Notice how the turtles clump up into little clusters.  This is because they are moving over themselves frequently, which increases the chances of attaching to their tail.  This makes sense if the donut allows the turtles to check close to themselves, but if it does not (NEAR-RADIUS is big) then the same thing still happens.  Why is this the case?

Notice that we are graphing all four possible turtle states, but only three appear on the graph.  Do you know why?

Try implementing different rules for how turtles follow each other.  For instance, interesting results can be seen if the "towards-nowrap" primitive

You might also try giving the turtles a certain probability of breaking apart again.  See how this affects the patterns they make.


Note the use of the "towards" primitive to make the turtles follow each other.