

To see in-radius in the sample models see Fireflies, Flocking, and Simple Kinetics 3. To see neighbors and neighbors4 in the sample models see Shepherds, Altruism, GenDrift P local, Ising, Crystallization models, CA models, Fire, Rumor Mill, Segregation, and Voting. The Modeling Commons contains more than 2000 other NetLogo models.
Netlogo examples how to#
Moore & Von Neumann Example shows how to use square (Moore) or diamond (Von Neumann) shaped neighborhoods of any size. View, run, and discuss the GIS General Examples model, written by Uri Wilensky. This is particularly useful in cellular automata models.
- : reports those agents in agentset at the given points relative to the caller, where list is a list of two-number lists.Īlthough in this example, we only change the color of the reported patches, you can of course do more complicated operations, including assigning that agentset to a variable.
On a torus there will always be four neighbors. Neighbors4: reports the same patches, excluding the ones at the corners. If the world is a torus every patch will have eight neighbors, if wrapping is not allowed in either direction the edge patches will have fewer neighbors.

Neighbors: reports the patches surrounding a patch or turtle both patches that share a side and those that share a corner. These include neighbors, neighbors4, in-radius, and at-points: This code example shows how to use the basic neighborhood primitives.

You can also Try running it in NetLogo Web If you download the NetLogo application, this model is included. (back to the library) Neighborhoods Example NetLogo Models Library: Neighborhoods Example
