to spin-web2
pen-down
go-straight
waituntil [see-black]
wait 18
turn
wait 40
spin-web2
end
to eat
d, on
loop[
waituntil [not switch 7]
waituntil [
switch 7]
d, rd]
end
to eat-mode
forever [eat]
follow-line
end
to follow-line
go-straight
loop [
if see-black? left-sensor
[turn-left]
if see-black? right-sensor
[turn-right]]
end
to go-straight
ab,
thisway
on
end
to pen-down
c,
thisway
on
end
to pen-up
c,
thatway
on
end
to turn
pen-up
ab, rd onfor 45
ab, off
b, rd
ab, onfor 17
go-straight
end
to see-black
output (sensor 0) > 120
end
to turn-left
left-wheel off
right-wheel on thisway
end
to turn-right
right-wheel off
left-wheel on thisway
end
to left-wheel
b,
end
to right-wheel
a,
end
to see-black? :sensor
output :sensor > 120
end
to left-sensor
output sensor 1
end
to right-sensor
output sensor 2
end