I am trying to write code in Netlogo to ask turtles wait for a certain time (eg:2 seconds) if his neighbours are less than a certain distance. after the distance between him and his neighbours is more than that distance, this turtle can start to move. Here's my pieces of code:
My initial setup for turtles:
;;send people back to where they come from
ask turtles [
move-to one-of road with [not any? other turtles in-radius 4]
]
Ask turtles to move:
to move
face best-way-to goal
ifelse patch-here != goal
[
ifelse how-close < 2
[wait 2 fd 1]
[fd 1]
]
[stop]
end
to-report keep-distance
set close-turtles other turtles-on (patch-set patch-here neighbors4)
ifelse any? close-turtles
[set how-close distance min-one-of close-turtles [distance myself]]
[set how-close 100] ;this means cannot find neighbours around this people
report how-close
end
but this doesnt give me what I want. Does anybody have any idea how to realise this in Netlogo? Any help is really appreaciated. Thanks!