;; a, left
;; b, rightto baby-duck
when [newir? ] [find]
loop [walk]
endto walk
loop [
forward
if switcha [hit]
turn
if switcha [hit]
]
endto find
sing1
a, thisway on
b, thatway on
wait 10
ab, thisway on
wait 20
ab, off
end
to hit
sing2
ab, thatway
onfor 10
b, thisway
ab, onfor 7
ab, thisway
endto sing1
beep
endto sing2
beep
endto forward
number
a, thisway on
b, thisway on
wait num
ab, off
endto turn
choose
number
ifelse (dir)
[ a, thisway on b, thatway on]
[ a, thatway on b, thisway on]
wait (num)
ab, off
endglobal [num chose dir]
to number
setnum (random)
ifelse ( num < 1000)
[setnum (num / 100)]
[setnum (num / 1000)]
endto choose
setchose (random)
ifelse (chose < 16384)
[setdir 0]
[setdir 1]
endto hit?
loop [when [switcha] [beep] ]
end