bubbalouie
bubbalouie

Reputation: 663

Netlogo: How to iterate over agentset and set variable speed

I am attempting to iterate over a set of turtles and assign each of them a different, random speed. When I attempt to use:foreach turtles [ ... ] I get an error message stating "cannot iterate over agentset". I know I can use ask for setting all turtles the same, but I want to have turtles moving at different speeds from one another.

Upvotes: 2

Views: 4175

Answers (1)

Seth Tisue
Seth Tisue

Reputation: 30453

ask can do this job just fine:

ask turtles [
  set speed random 10
]

this will give each turtle its own different, random speed.

Upvotes: 7

Related Questions