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

Emergence 2009: Langton's Ant VI


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

Back to index of models


Download/view: LangtonsAntmod1.nlogo


This is a modification of the Langton's Ant model. It is a deterministic model which means that if we start from the same set of conditions we get the same outcomes. What is interesting about this model is how it clarifies the concepts of emergence. From a deterministic model with a simple set of instructions we get a surprising outcome. When you observe the ant in this model it looks as though there is a change in the ant from when it is going around in a seemingly random fashion to when it starts building a path. To account for this change in behavior we might assume there is a change in the ant and that is has complex traits such as adaptability or purpose. Yet if we look at the code behind the model we can see that the instructions for ant behavior do not change so a change in environment must produce the change in behavior. The ant influences its environment and responds to changes in the environment but there is no actual change in the ant. So the model shows that the ant behavior can be coded for by a simple set of instructions and demonstrates the fact that seemingly complex behavior can arise from simple interactions between an agent and its environment.

In this model the world is made of patches and ants. The ants are the agents and the patches represent the environment. Once the ants are created into the world they follow a simple set of instructions to go forward, change the color of the patch depending on the patches previous color, turn a certain number of degrees, and repeat the procedure. The instructions for changing the patch color are as follows: if the patch encountered is yellow turn the patch black and if the patch is black turn the patch yellow.


The setup button clears the world and allows you to create a number of ants using the NUM-ANIMALS slider. You can also determine the degree to which you want the ants to turn after they go forward and change their patch color.

The GO cause the ants to start to move and follow the instructions set. There is also a GO-FOREVER button which allows you to view their behavior continuously instead of visualizing each step they take.


This model allows you to vary the number of ants, the number of steps they take forward and the degree to which they turn after changing their patch color. This is interesting because you can compare/contrast the affects of having many ants versus one and take note of whether the behavior of one ant changes influences another ant's behavior. You can also change the number of steps an ant takes before changing patch color and turning and observe what impact this has on behavior of the ant. In addition notice how changing the degree to which they turn affects whether the path is built and when it is built.


What different behaviors result when there are multiple ants? Do ants influence each other's behavior? Notice what happens with 2 ants at a turn angle of 60 with steps forward set to 1. Can you explain why the roads form and disappear?

How does changing the number of steps forward change what happens? Try a given number of ants, with a turn-angle of 60 and vary the number of steps forward. Why do we get surprising results?

What affect does turn angle have on resultant behavior? Try angles 45, 60, 90, 120 and 170. What is the explanation for behavior of the ants at a turn angle of 120? Why do certain angles result in the path being formed and others do not? What is the difference the behavior of ant at smaller turn angles and larger turn angles?

There are many ways to extend the model by changing the set of instructions given to the ants. For example you can change how the ants affects their environment by changing the set of instructions for changing patch color. Simple changes to the model result in significantly different patterns of behavior.
One interesting feature of Netlogo that could be used is the ticks feature which could allow you to measure the amount of time it takes for the ant to change from the seemingly random behavior to when it starts building a road.
Related models include the Langton's Ant model on Serendip and the Vants model on NetLogo.

The rules for Vants were originally invented by the artificial life researcher Chris Langton.

Copyright 2005 Uri Wilensky. All rights reserved. See for terms of use.


Models created using NetLogo.


Charles A. Rockafellor's picture

Langton's Ant

Excellent execution of the Ant. I wonder--meaning no insult, have you worked with George Maydwell at all? He has a very flexible GUI for CA/etc. (SARCASim), and I'm thinking that somewhere between his application and yours, there must be a simple way to run heat-maps on them (it's been done, but I don't think on quite such a flexible rule set of degrees as yours). Now, if only there were an easy way to implement all of this in MCell...

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.
7 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.