Home Download Help Forum Resources Extensions FAQ NetLogo Publications Contact Us Donate Models: Library Community Modeling Commons Beginners Interactive NetLogo Dictionary (BIND) NetLogo Dictionary User Manuals: Web Printable Chinese Czech Farsi / Persian Japanese Spanish
|
NetLogo Models Library: |
If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web |
This code example shows how agents can "partner up" with each other. Each turtle will pair up with another turtle. Each turtle in a pair are aware of this partnership, preventing mismatched partners and multiple partners.
In this example, the turtles needs to be on the same patch to form a partnership, but you can easily change it to be turtles within a given radius (by using in-radius
), or using no spatial requirements at all.
Pairing turtles is used by many models that require single turtle interactions. One example is models that require turtles to reproduce with another turtle. Another example is the GasLab models where molecules are forced to only interact with one other molecule at time, which simplifies the code by preventing a three (or more)-way collision.
Turtles with no partner are gray; partnered turtles are red. Unpartnered move randomly about the View until they land on a patch with another unpartnered turtle. When this happens, the two turtles form a partnership and stop moving.
Grouping Turtles Example shows how to form groups that contain more than two turtles.
(back to the NetLogo Models Library)