Beginners Interactive NetLogo Dictionary (BIND)
Farsi / Persian
NetLogo Models Library:
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.