to irsensor
output sensora
end

to sees-black? :sensor-value
output :sensor-value > black
end

to black
output irsensor > 50
end

to white
output irsensor < 50
end

to sees-white? :sensor-value
output :sensor-value > white
end

to lower-magnet
b, onfor 16 thatway
end

to raise-magnet
b, onfor 15 thisway
end

to initialize
a, setpower 2
b, setpower 8
end

to Whirl-A-Carbon
a, on
waituntil [sees-black? irsensor] a, off
send 1
waituntil [newir?] a, on
waituntil [sees-white? irsensor] Whirl-A-Carbon
end

to crane
waituntil [newir?]
lower-magnet
raise-magnet
send 2
crane
end