2

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.

bubbalouie
  • 643
  • 3
  • 10
  • 18
  • Instead of cycles, you need to think this as a set operation. You ask the set to do something. Also, using cycles has a performance penalty on your models. – Edmundo Apr 05 '16 at 22:46

1 Answers1

7

ask can do this job just fine:

ask turtles [
  set speed random 10
]

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

Seth Tisue
  • 29,985
  • 11
  • 82
  • 149