Turtle, Observer, Patch |
stop
to check-patch-color
if pc-ahead = red [rt 90 stop]
if pc-ahead = green [lt 90 stop]
fd 1
end
This procedure will cause turtles to turn right and then exit the procedure if the the patch ahead is red, turn left and exit the procedure if the patch ahead is green, and only move forward one if the patch ahead was not green or red.