How to stop turtles when all patches have been colored in Netlogo?
When the turtles have covered the world in patches, I would like the turtles to stop on the last one so that I can record the amount of ticks it took.
Here is my code so far:
turtles-own [time-since-last-found]
to setup
ca
ask n-of num-clusters patches [
ask n-of 20 patches in-radius 5 [
set pcolor red
]
]
crt 1 [ set shape "person"
set color yellow
set size 2
set time-since-last-found 999
pen-down
]
reset-ticks
end
to go
ask turtles [search]
tick
end
to search
ifelse time-since-last-found < 20 [
right (random 181) - 90
] [
right (random 21) - 10
]
fd 1
ifelse pcolor = red [
set time-since-last-found 0 set pcolor blue
] [
set time-since-last-found time-since-last-found + 1
]
end