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