NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo Models Library:
Sample Models/Social Science

(back to the library)


[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


This model simulates students' ideas about scattering, which takes place just before exercising in gym. The students in a class start out all bunched up, and the teacher asks them to spread out or scatter. This simulation shows the spread of the group when the individual students follow simple rules to decide whether to move and where. The scatterers move according to rules that were gleaned from several interviews with sixth-grade students.

The students were asked: "At the beginning of a Physical Education class, the students are standing close together. The teacher tells the students to scatter so they may perform calisthenics. What happens? Can you describe and explain?" The students described the scattering process verbally, using coins to simulate the process and drawing a series of pictures to depict the succeeding steps.


This model implements several scattering rules, which the user can mix and match:

RANDOM-MIN: Move in a random direction until you are far enough away from all of your neighbors. Random-min turtles (the violet ones) set their heading and move in a random direction if and only if there are turtles that are too close.

OPEN-MIN: Move into the largest open nearby space until you are far enough away from all of your neighbors. Open-min turtles (blue) also stop when other turtles are too close. If there are turtles that are too close, they find the heading that will take them to the largest open space.

OPEN-MIN-MAX: Move into the largest open nearby space until you are far enough away, but not too far. If you're too close, move away. If you're too far, move closer. The open-min-max turtles (orange) move to the largest open space if other turtles are too close. If the other turtles are too far away (that is, there aren't turtles within a certain space), the turtle in question moves to a more populated area.

Two of the scattering rules do not have stopping conditions, so they continue scattering indefinitely:

RANDOM-AWAY: Move in a random direction away from the person that is closest too you. Random-away turtles (pink) look at the turtle closest to them and move in the opposite direction.

RANDOM: Move about randomly, disregarding all other scatterers. Random turtles (brown) just run around in a random direction, never looking at the turtles around them.

The scattering students move at equal speeds, if they move at all. Two students cannot occupy the same location. Whether or not to move and where to move depends on each of the rules that are described. The color of the scattering students reflects the rule that they are following.


Use the sliders to the right of the view to specify the number of turtles to create with each rule.

With the first three rules, the TOO-CLOSE slider sets the distance, in patches, that the turtles must be away from other turtles before stopping. The NUM-RANDOM-MIN slider indicates the number of turtles to create that move in a random direction, stopping when they are at least the distance specified by TOO-CLOSE from other turtles. Use the NUM-OPEN-MIN slider to specify how many turtles to create that move to the largest open space if there are turtles within TOO-CLOSE.

NUM-OPEN-MIN-MAX specifies the number of turtles to create that must have turtles within a certain range in order to stop. TOO-CLOSE indicates how far away other turtles must be for a turtle to stop, and TOO-FAR indicates how close the turtle in question must be to at least another turtle for it to stop.

The NUM-RANDOM-AWAY slider indicates the number of turtles to create that move away from the closest turtle, without ever stopping. NUM-RANDOM indicates the number of turtles that move in random directions without stopping.

To indicate the radius within which you want the turtles to be initially scattered, use the INITIAL-RADIUS slider. INITIAL-RADIUS must be large enough to fit the number of turtles indicated by the above sliders. See NetLogo Features, below.

To vary the distance that a turtle moves each time step, change the STEP-SIZE slider.

Press SETUP to create the number of turtles indicated, in the INITIAL-RADIUS specified. Press GO to start the model and the plots.

The plot AVERAGE DISTANCE FROM ORIGIN shows the average distance that turtles of a certain rule have moved from their original position over time. It is color-coded to match the colors of the turtles. To observe the average distance of turtles of a certain rule, watch the line of the same color.

The MOBILITY OF SCATTERERS histogram displays the average total distance moved by turtles within a certain range away from the origin. Each of the bars plots the average total distance of turtles in five concentric circles radiating from the center patch. Note that this differs from that of the AVERAGE DISTANCE FROM ORIGIN plot, which measures the distance from the turtle's present spot to its original spot, in that it adds up each step taken by the turtle.

The TICKS monitor displays the number of clock cycles that GO has run.


While the group is spreading, notice the individual turtles' routes. You can use the "watch turtle" functionality (by clicking on a turtle) or pen-downing a single turtle to observe its path. Try this with a number of turtles. How do the individual and group patterns relate?

Like two people walking towards each other down a hallway trying to avoid colliding, the rules of the turtles deciding their heading based on other turtles can conflict. For instance, several neighboring turtles moving to the largest open space may choose to move to the same open spot and, in doing so, move closer to the other turtles. This can form clusters of turtles, even while the group is spreading and even in the periphery of the group.

Certain rules get to a settled, or scattered, state more quickly than others do. Which rules are better for efficient scattering?

Observe the shape of the "Average distance from Origin" plot: Why is it shaped the way it is? What other phenomena behave in a similar way?

When observing the MOBILITY OF SCATTERERS plot, notice how scatterers farther on the outside will sometimes move a greater total distance or a smaller total distance, depending on the rule.

There are often threshold values where the scatterers will never settle down, and the model will not stop. For instance, if TOO-CLOSE is too great and there are too many turtles, they will never have enough room to completely scatter.

Some of the rules produce a more ordered end formation than others. Why is this, and which ones exhibit this behavior? Do any regions show higher densities than others?

When certain rules are mixed together, segregation occurs. That is, turtles of a certain rule tend to be surrounded by more turtles of the same rule than not. Which combinations of rules produce this segregation more than others?


When experimenting with the move-into-range turtles, vary the TOO-CLOSE and TOO-FAR sliders concurrently with the STEP-SIZE slider. If the step size is too big and the TOO-CLOSE and TOO-FAR values creating too narrow of a range, will the scatterers ever settle?

Try mixing rules to explore how turtles of different rules interact with each other.

Watch what happens when a few random-scatter turtles run around a set of turtles with stopping conditions, like move-to-open-space turtles.

Vary the STEP-SIZE slider, and see what effect this has on the model. Does a bigger step size make for more or less efficient scattering?

Try varying INITIAL-RADIUS to make the starting formation tighter or more spread out.

Pen-down one turtle, and watch its path as it moves about the world. How does it compare with the group?

Which rule seems to simulate real situations of scattering people?


Try to think of other rules that scatterers follow. For example, figure out rules to get the turtles to fill up the entire space. Alternatively, turtles could move towards a friend or away from an enemy. Also, try to think of stopping conditions other than being a certain distance from other turtles.

Turtles could have a variable stubbornness, indicating how likely a turtle is to move or not. A dawdle or friendliness variable could indicate a likeliness to hang around other turtles.

Try giving the scatterers the ability to back track. For instance, if a scatterer moving to an open space finds that their movement takes them to a more populated area, they could move back to where they were before.

Allow turtle to have varying speeds or step sizes, simulating the differing stride lengths of individual scatterers

Devise other ways to model the scattering in the aggregate sense; for example, measure the density in a certain area.

What if there was a location (e.g. a fire) that people were trying to get away from while scattering? Devise a way to model such a situation. You can include physical structures, such as walls and doors.


The model creates turtles by asking patches to sprout a turtle initialized with a certain rule. Because a patch can only sprout one turtle, only a certain number of turtles can fit in a certain radius. The model verifies that the user hasn't asked for more turtles than can fit in the initial-radius specified to avoid an error.


The study is described in Levy, S.T., & Wilensky, U. (2004). Making sense of complexity: Patterns in forming causal connections between individual agent behaviors and aggregate group behaviors. In U. Wilensky (Chair) and S. Papert (Discussant) Networking and complexifying the science classroom: Students simulating and making sense of complex systems using the HubNet networked architecture. The annual meeting of the American Educational Research Association, San Diego, CA, April 12 - 16, 2004.

Thanks to Stephanie Bezold for her work on this model.


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:


Copyright 2004 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at

This model was created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

(back to the NetLogo Models Library)