Frage

Is there any primitive to introduce a delay in the running of the NetLogo in between the execution of a model?

War es hilfreich?

Lösung

You can use the wait primitive to do this.

print "hello"
wait 2
print "there"

will print "hello", wait 2 seconds, then print "there".

That said, I would highly recommend avoiding using wait (and the related every). There are almost always better ways to do things. One big problem with wait is that it makes the speed slider (at the top, under the tabs) almost useless. If you want to just slow things down, use the speed slider. If you want an agent to a wait a little bit before doing something, give it a variable that counts down to 0; when the variable hits 0, then the agent performs the action. That way, the whole simulation doesn't pause, just the agent.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top