when and whenever

2 views
Skip to first unread message

howard...@gmail.com

unread,
Nov 20, 2012, 10:49:09 AM11/20/12
to modell...@googlegroups.com
I am not sure why in this model:


jobs are not distributed along the shoreline at least 10 patches apart

am i using when and whenever correctly? (does whenever also need a do-every?)

Ken Kahn

unread,
Nov 21, 2012, 4:25:23 AM11/21/12
to modell...@googlegroups.com
The jobs are distributed at least 10 patches apart. I did this

observer> show [(list xcor ycor)] of all-of-kind "Job"
observer: [[-12 14] [0 0] [-19 -3] [-10 37] [-2 -49] [-2 16] [-23 15] [-23 -46] [-12 -15] [-21 -22]]
observer> ask all-of-kind "Job" [set size 10]

to confirm it. No jobs touch each other so they must be at least 10 patches apart.

The use of when and whenever is fine. 'whenever' runs at every scheduled time. If you aren't using fractional ticks then it runs every tick. If you are using fractional ticks and it OK to run the action of the 'whenever' at any time during a tick (rather than at an exact fractional time within that tick) then do-every combined with 'if' will be faster code. But you never need to have 'do-every' call 'when' or 'whenever'.

Best,

-ken

--
You received this message because you are subscribed to the Google Groups "The Modelling4All project" group.
To view this discussion on the web visit https://groups.google.com/d/msg/modelling4all/-/wXe6yzEyUbEJ.
To post to this group, send email to modell...@googlegroups.com.
To unsubscribe from this group, send email to modelling4al...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/modelling4all?hl=en.

Reply all
Reply to author
Forward
0 new messages