turtles-here

 

turtles-here reports an agentset that contains all the turtles on the same patch with the original turtle, including the original turtle itself. For example, if we wanted to create a contagious disease model where red turtles passed the disease to all the turtles on the same patch, we would write the following code:

ask turtles with [color = red][
    ask turtles-here [
        set color red
    ]
]

Things to keep in mind when using turtles-here:

In the model example below, we have three white patches that represent hospitals and some turtles that represent people. Some of our turtles are green, which indicates that they are healthy, and some are violet/purple, which indicates sickness. We use turtles-here to ask white patches to heal violet people.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the turtles-here primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the turtles-here primitive:
 
 
Similar primitives:
neighbors

Reports an agentset containing the eight neighboring patches.

Read more
patches

Reports an agentset that contains all the patches in a model.

Read more
other

Reports an agentset which is the same as the input agentset but omits the agent that used this primitive.

Read more
in-radius

Reports members of an agentset within a certain radius of an agent.

Read more
 
Learn another primitive: