# # Figure out if we are on the outer edge # Takes into account Markers instead of $sense_for # Assert ant.dir==0 # edge 0,1 have Ahead Sense Ahead @edge01 @edge2345 $sense_for edge2345: Turn Right PASS # edge 2,3 have Right Sense RightAhead @edge23 @edge45 $sense_for edge23: # edge 2 has ahead Sense Ahead @is_edge2 @is_edge3 $sense_for edge45: Turn Right PASS # edge 4 has Right Sense RightAhead @is_edge4 @edge5mid $sense_for edge5mid: Turn Right PASS # edge 5 has right Sense RightAhead @is_edge5 @is_middle $sense_for edge01: # edge0 has no right Sense RightAhead @is_edge1 @is_edge0 $sense_for is_edge0: Type 1 Mark $M_EDGE PASS # orient outward #Print (ant.type, ant.dir) Turn Left PASS #Print (ant.type, ant.dir) Move PASS PASS Goto @edge_done is_edge1: Type 2 Mark $M_EDGE PASS #Print (ant.type, ant.dir) # orient outward Turn Right PASS Move PASS PASS Goto @edge_done is_edge2: Type 3 Mark $M_EDGE PASS #Print (ant.type, ant.dir) # already oriented outward-ish Move PASS PASS Goto @edge_done is_edge3: Type 4 Mark $M_EDGE PASS #Print (ant.type, ant.dir) # orient outward Turn Right PASS Move PASS PASS Goto @edge_done is_edge4: Type 5 Mark $M_EDGE PASS #Print (ant.type, ant.dir) # orient outward Turn Right PASS Turn Right PASS Move PASS PASS Goto @edge_done is_edge5: Type 6 Mark $M_EDGE PASS #Print (ant.type, ant.dir) # orient outward-ish Turn Right PASS Sleep 15 Move PASS PASS Goto @edge_done is_middle: Turn Left PASS Turn Left PASS Turn Left PASS Assert ant.dir==0 Sleep 34 Goto $middle_ant edge_done: Goto $edge_ant