lovedavidsilva
lovedavidsilva

Reputation: 45

netlogo How to count total number of turtles within some distance

I am trying to control the moving speed of turtles base on the population of its area. My problem is that how to count total number of turtles that have a distance smaller than 3 with current turtle, and store this number into a new variable?

Upvotes: 2

Views: 1930

Answers (1)

JenB
JenB

Reputation: 17678

Have a look at the in-radius primitive in the NetLogo dictionary. Most likely you will want a command similar to ask turtles [ set varname count turtles in-radius 3 ]

Upvotes: 3

Related Questions