Serendip is an independent site partnering with faculty at multiple colleges and universities around the world. Happy exploring!

Emergence 2009: Langton's Ant II

Emergence

Biology 361 = Computer Science 361
Bryn Mawr College, Spring 2009

 

Back to index of models

 

Download/view: Rotator01.nlogo

 

WHAT IS IT?
This is a modified version of Langton's Ant wherein turtles move two steps instead of one. Also, turtle motion is tied to a patch variable other than color and the visualization of turtle motion is done with pens instead of patch color. The model runs in two directions, and can auto-reset at a point set by the observer.
HOW IT WORKS

This model more-or-less follows the basic Langtan's Ant procedure. Differences are:

-Turtles move two steps instead of one.

-Turtles do not respond to patch color, but another patch variable called 'state,' which can be either on or off.

-Since turtles do not affect patchc color, potion can be tracked as a drawing, which shows the complete patch of the turtle and does not affect the patch of other turtles.

-When the number of patches a turtle has visited reaches the observer-defined 'reset-point,' the model runs a 'safe-setup' procedure. This is much like 'setep' but does not clear-all, so drawings and some variables are conserved. Also, the heading at which the turtle starts is increased by 30 degrees at each reset.

-The 'Finish & Center' button allows a turtle, once stopped, to complete its path until it reaches the reset-point, at which time it picks up its pen and jumps to the origin (useful between direction changes).

HOW TO USE IT

SETUP works as usual.

FORWARD runs like a basic Langton's Ant except with setps of length 2.

REVERSE is like FORWARD but turtles move back and rules are reversed.

ANGLE lets the observer set the initial heading.

FINISH & CENTER works as described above and can be used between changes of direction (mainly for aesthetic purposes).

RESET causes the model to do a safe-setup after a number of patch visits defined by the user in the RESET-POINT input box.

RESET-POINT can be any number, but I suggest something between 1500 and 2000.

THINGS TO NOTICE

The inspiration for this model came from noticing that with a turtle that moves forward two steps instead of 1, you still get something that looks basically like Langton's Ant. More interestingly, you get the same behavior witht he heading set to any multiple of 30 (which is not true for the 1-step version).

Because the model uses a pen to trace turtle motion, you are seeing the complete patch of the turtle.

Also note the 'while' loops in the 'center' procedure, and the conditions in 'go' and 'go-back' which keep the loops from being infinite.

When the RESET is on, watch how the 'angle' slider moves by itself.

THINGS TO TRY
Start with reset off and just look watch the basic pattern. Try starting with different headings and notice that the basic pattern produced rotates but does not change. Note the difference when the model runs backwards. Now turn the reset on and set a reset-point. Run the model and watch it rotate, eveuntaully making a radially symmetrical pattern. Stop, finish & center, and run in the other direction. Try changing directions without using finish & center and see if you can figure out why I created it.
RELATED MODELS
Vants.
CREDITS AND REFERENCES
Thanks to Paul Grobstein and the Emergence 2009 class for their input and insight.

 

Models created using NetLogo.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
To prevent automated spam submissions leave this field empty.
1 + 17 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.