NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 NetLogo Publications
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Farsi / Persian
 Japanese
 Spanish

  Donate

NetLogo Models Library:
Code Examples

(back to the library)

Scatter Example

[screen shot]

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

WHAT IS IT?

This code example shows three ways to scatter turtles across the world. One way scatters them evenly across the world. The second way scatters them in a circle. The third puts them on the center of random patches.

THINGS TO NOTICE

With SCATTER2, the density of turtles in the center is higher than the edges.

With all three scatter methods, sometimes turtles can land on the same patch. If you want to create turtles on patch centers and restrict them to one turtle per patch, the easiest way is not to create the turtles and then move them to the patches, but directly ask the patches to create the turtles, as follows:

  ask n-of 300 patches [ sprout 1 ]

RELATED MODELS

Scatter

(back to the NetLogo Models Library)