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

Emergence 2009: Final Projects, VII


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


Back to index of models



Download/view: MotionComparison.nlogo



This is a model about showing various movements of turtles and comparing them by how much height they travel...the turtle with the most height in total/highest average height wins!

The real-life context of this model could be of different variations on motion in hiking or some other outdoor adventure sport.

When setting up the model, two turtles are created. One that has a random heading that travels randomly as well. While the other turtle goes straight. In the procedures is code for creating peaks (or heightened patches). The object in this model is to see what turtle succeeds in traveling with the most height. The number of peaks can be controlled by a sliding bar. I have a variable: height and global variables: maxheight, turt0total, turt1total, turt0avg, turt1avg, turtle1 and turtle2. I use the height variable for the height of ecah patch, the maxheight variable for how high the highest peak is, turt0total holds the sum of the heights that Turtle 1 (referred to as 0 in code) makes as each tick goes on (the same applies to Turtle 2 (referred to as 1 in code, and the variable turt1total). 'turt0avg' and turt1avg are variables that give the average height covered over many ticks. 'turtle1' and turtle2 are variables that say what the height is that the turtle is on (it is used in plotting graphs for Turtle 1 and Turtle 2).

Start out with no predators. This will show the same trends as in the Non-Selective version.

Now add a predator (or predators)- how do predators affect the mean and distribution of trait values? How do they affect diversity?

This demonstrates selection. Prey with higher trait values are more likely to survive long enough to reproduce. This creates a shift in the trait value distribution toward the higher end of the range and increases the mean value. It also creates a slight drop in diversity, as a disproportionate number of prey have high trait values.

Try again with more predators. Does selection happen faster? Using the TRAIT-VALUE-DISTRIBUTION chooser, set up two populations with different initial trait values. Is one favored? Do they evolve at the same rate?

Note that mean trait values never stabilize all the way at the maximum value, as you might expect. This is due to the right-wall effect (some offspring of prey with a trait value of 9 will die, as they


To start, the model has the SETUP MODEL button which initializes the model. The height of the highest peak (maxheight) is random every time.

There is a slider button that says NUMBER, meaning the number of peaks that are generated when you SETUP MODEL. Slide the bar back and forth to eiher decrease or increase the number of peaks.

The START MODEL (1-STEP) button moves the model through one 'tick' of progress.

The START MODEL (INFINITE) button moves the model continously.

A HEIGHT OF THE HIGHEST PEAK monitor is given for the observer.

TURTLE 1 TOTAL HEIGHTS REACHED is a monitor which states the (increasing) sum of heights that Turtle 1 travels at each peak. The same goes for TURTLE 2 TOTAL HEIGHTS REACHED.

TURTLE 1 AVG is a monitor that gives the average of total height traveled divided by the ticks progressed. The same goes for TURTLE 2 AVG.

Finally, there is some graphical representation of the data collected. Two graphs are shown on the interface: 'turtle1' graph which plots ticks on the x axis and the height traveled at each respective tick on the y axis. The same design applies to the 'turtle2' graph.

Notice that because of the differing headings of Turtle 1 and Turtle 2, Turtle 1 which moves randomly always has the higher amount of height traveled and averaged.
Try to vary the number of peaks and compare how fast the turtles gather height as compared to other amounts of peaks.
To extend the model, I was thinking of adding another (one or more) motion behaviors which can affect turt0total & turt1total. Also, along with those additional behaviors, figuring out how to make each turtle have an 'on/off' switch for easy comparison would be an appropriate addition.
An interesting feature of NetLogo in this model is the color gradation that is used for the peaks. You can easily make the color represent differences (for this example in height of peaks with this model) in how high each patch particularly is by what color green it is. Autoplotting the two graphs is a great, handy feature that NetLogo has as well as the ability to change the graphic of the turtle (which is better for representation).
Our Emergence class (Spring '09) and Professor Paul Grobstein! Thanks so much for your help and for a great experience this semester!


Models created using NetLogo.


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