How does NetLogo decide when to switch from agent to agent when running code?
If you ask turtles, or ask a whole breed, the turtles are scheduled for execution in ascending order by ID number. If you ask patches, the patches are scheduled for execution by row: left to right within each row, and starting with the top row. If you ask a different agentset besides the set of all turtles or patches or a breed, then the execution order will vary according to how the agentset was constructed. The execution order is chosen deterministically and reproducibly, though, and will remain the same if you ask the same agentset multiple times. In a future version of NetLogo, we plan to add an option for randomized scheduling. Once scheduled, an agent’s “turn” ends only once it performs an action that affects the state of the world, such as moving, or creating a turtle, or changing the value of a global, turtle, or patch variable. (Setting a local variable doesn’t count.) To prolong an agent’s “turn”, use the without-interruption command. (The command blocks inside some commands,