global [NOSE]
; "thisway" = forward, "thatway" = backward; "MommaWalk" is the final code
to MommaWalk
loop [
setNOSE 255
Wings on
print "Serpentine
Serpentine
setNOSE 0
Squawk
print "Squawk wait 20
]
end
;"Serpentine" is the basic walk.to Serpentine
forever[
repeat 2 [ SemicircleLeft SemicircleRight ]
print "next wait 10
repeat 2 [ SemicircleRight SemicircleLeft ]
print "last wait 10
]
every ((random 11) + 10) [ Nod ((random 10) + 5)]
waituntil [ not NOSE ] stoprules LeftRight off
end
;"Squawk" is response to running head-on into somethingto Squawk
launch [ ; stop, back up, turn left
LeftRight off
LeftRight thatway onfor 15
Right thisway on
Left thatway on
wait 10
LeftRight off
]
launch [ ; head nods back and forth 3x for 0.5s.
repeat 3 [ Nod (5) ]
]
end
;"Nod :num" takes an integer input and moves the head either left or right (also randomly determined) for time "num"to Nod :num
;if (:num > 8)
; [Neck rd] ;will switch direction head nods half the time.
Neck thisway onfor :num
Neck thatway onfor :num
end
to SemicircleLeft
repeat 5 [ fwd 5 turnLeft 7 ]
endto SemicircleRight
repeat 5 [ fwd 5 turnRight 7 ]
endto turnRight :t
Left thisway onfor :t
endto turnLeft :t
Right thisway onfor :t
endto fwd :t
LeftRight thisway onfor :t
endto Nose
output sensor 0
endto LeftRight
ab,
endto Left
a,
endto Right
b,
endto Neck
c,
endto Wings
d,
end
to emit
loop [send 1]
end