# Scatter

### 2 collaborators

Uri Wilensky (Author)
Sharona T Levy (Author)

### Tags

social science

Tagged by Reuven M. Lerner almost 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 732 times • Downloaded 69 times • Run 0 times

## WHAT IS IT?

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.

## HOW IT WORKS

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.

## HOW TO USE IT

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.

## THINGS TO NOTICE

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?

## THINGS TO TRY

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?

## EXTENDING THE MODEL

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.

## NETLOGO FEATURES

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.

## CREDITS AND REFERENCES

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. http://ccl.northwestern.edu/papers/midlevel-AERA04.pdf

Thanks to Stephanie Bezold for her work on this model.

## HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

• Wilensky, U. (2004). NetLogo Scatter model. http://ccl.northwestern.edu/netlogo/models/Scatter. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
• Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

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 http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

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.

## Comments and Questions

Click to Run Model

```turtles-own
[
nearby-classmates         ;; agentset of turtles within some specified radius
closest-classmate         ;; the nearest turtle
stopped?                  ;; if the turtle hasn't moved
rule                      ;; the turtle's rule (the rules are named by strings)
origin                    ;; the turtle's original position
close-classmates          ;; turtles within the too-close range
far-classmates            ;; turtles within the too-far range
total-distance-moved      ;; total distance moved by the turtle
previous-patch            ;; patch the turtle was previously on
]

;;
;; SETUP AND HELPERS
;;

to setup
clear-all
set-default-shape turtles "circle"
make-turtles
reset-ticks
end

to make-turtles
if [count patches in-radius initial-radius] of patch 0 0 < num-turtles-to-create
[ user-message (word "There aren't enough patches in initial-radius to create the number "
"of turtles you've asked for.  Please make initial-radius larger or decrease "
"the number of turtles.")
stop ]
ask patch 0 0 [
create-initial-turtles num-random-min   "random-min"   violet
create-initial-turtles num-random       "random"       brown
create-initial-turtles num-random-away  "random-away"  pink
create-initial-turtles num-open-min     "open-min"     blue
create-initial-turtles num-open-min-max "open-min-max" orange ]
set-common-variables
end

;; reports the total number of turtles the user has requested

to-report num-turtles-to-create
report num-random-min +
num-random +
num-random-away +
num-open-min +
num-open-min-max
end

;; ask n random patches without a turtle on them that are within initial-radius of the
;; asker to sprout a turtle with the rule set to turtle-rule and color to turtle-color

to create-initial-turtles [n turtle-rule turtle-color]
ask n-of n (patches in-radius initial-radius with [not any? turtles-here])
[ sprout 1
[ set rule turtle-rule
set color turtle-color ] ]
end

;; initializes turtle variables
;; also moves the turtles a bit so that they are a bit more randomly scattered

to set-common-variables
[ set xcor xcor - 0.5 + random-float 1
set ycor ycor - 0.5 + random-float 1
set origin patch-here
set stopped? false
set total-distance-moved 0 ]
end

;;
;; GO AND TURTLE STRATEGIES
;;

to go
if all? turtles [stopped?] [ stop ]
set previous-patch patch-here
if rule = "random-min"   [ move-random-min ]
if rule = "random"       [ move-random ]
if rule = "random-away"  [ move-random-away ]
if rule = "open-min"     [ move-open-min ]
if rule = "open-min-max" [ move-open-min-max ]
set total-distance-moved (total-distance-moved + (distance previous-patch))
]
tick
end

;; set a random heading and move at
;; each time step, with no stopping condition

to move-random ;; turtle procedure
rt random 360
avoid-walls
fd step-size
end

;; turtle procedure: set a random heading and move until
;; all other turtles are at least "too-close" away

to move-random-min
set nearby-classmates other turtles in-radius too-close
ifelse any? nearby-classmates  ; if there aren't turtles nearby, stop, you are scattered
[ rt random 360
avoid-walls
fd step-size
set stopped? false ]
[ set stopped? true ]
end

;; set heading in the direction opposite
;; of the closest turtle, without stopping

to move-random-away ;; turtle procedure
set closest-classmate min-one-of other turtles [distance myself]
face closest-classmate
rt 180
avoid-walls
fd step-size
set stopped? false
end

;; set heading towards the largest open space,
;; stopping when all other turtles are at least "too-close" away

to move-open-min ;; turtle procedure
set nearby-classmates other turtles in-radius too-close
ifelse any? nearby-classmates
[ facexy (mean [xcor] of nearby-classmates)
(mean [ycor] of nearby-classmates)
rt 180
avoid-walls
fd step-size
set stopped? false ]
[ set stopped? true ]
end

;; when turtles are too close, move to an open space,
;; when turtles get too far, move in towards a more populated area, and otherwise, stop

to move-open-min-max ;; turtle procedure
set close-classmates other turtles in-radius too-close
set far-classmates other turtles in-radius too-far
ifelse any? close-classmates  ; move to an open space
[ facexy (mean [xcor] of close-classmates)
(mean [ycor] of close-classmates)
rt 180
avoid-walls
fd step-size
set stopped? false ]
[ ifelse not any? far-classmates  ; move to a more populated space in the 'room'
[ facexy mean [xcor] of other turtles
mean [ycor] of other turtles
avoid-walls
fd step-size
set stopped? false ]
[ set stopped? true ] ]
end

;; if a turtle gets to a wall, it turns around

to avoid-walls ;; turtle procedure
if not can-move? 1
[ rt 180 ]
end

;;
;; PLOTTING
;;

;; if there are any turtles with turtle-rule as their rule, plot the
;; mean distance from the origin

to plot-rule-mean [turtle-rule]
if any? (turtles with [rule = turtle-rule])
[ plot mean [distance origin] of (turtles with [rule = turtle-rule]) ]
end

; Copyright 2004 Uri Wilensky.
; See Info tab for full copyright and license.
```

There are 10 versions of this model.

Uri Wilensky almost 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 11 years ago Updated version tag Download this version
Uri Wilensky over 11 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 12 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky almost 14 years ago Scatter Download this version

## Attached files

File Type Description Last updated
Scatter.png preview Preview for 'Scatter' about 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.