Open SFRailsback opened 6 years ago
I've only had a second to investigate, but I think "stop" inside of "snap" procedure is having a side effect of stopping the scheduler from dispatching. If you remove stop and use control logic like below, the simulation works fine.
to snap ; Executed by a trap when a ball lands on it
; Stop if trap has already snapped
if pcolor != black [
set pcolor red ; Show the snap
display ; So we can see things happen on the View
; Set View updates to ??? on-ticks?
set pcolor black ; Black means the trap has triggered
; Send 2 balls in air, determine where and when they land
repeat 2
[
let trap-ball-lands-on one-of (patches in-radius 5)
let ball-travel-time random-float (mean-flight-time * 2)
let ball-arrival-time time:plus current-time ball-travel-time "seconds"
time:schedule-event trap-ball-lands-on [ [] -> snap ] ball-arrival-time
]
; Finally, update outputs
update-output
]
end
But I will keep this issue open and try to see whether I can change behavior of stop to the pre-6.0 or perhaps I'll update the documentation since it's actually convenient to have a way to conditionally halt the simulation, something that wasn't possible before.
c0ced4cf6250bfdd6144c4e9e9bd453aa6588cb4
It does not seem to schedule new trap snaps in "snap". No error messages.