-- simple tree cutter
-- by pegasus@pimpninjas.org
-- thanks to Gopher/#computercraft
-- for the redstone trick
-- thanks to Lyqyd/#computercraft
-- for the os.pullEvent idea
print("this is woodcutter v8")
function cutDownTree()
if turtle.compare() then return end
if 0 ~= turtle.getItemCount(1) then
turtle.dig()
turtle.place()
else turtle.dig() end
for i = 1, 6 do
turtle.digUp()
turtle.up()
turtle.dig()
end
for i = 1, 6 do turtle.down() end
end
function wait ()
rs.setOutput("back", true)
os.pullEvent("redstone")
rs.setOutput("back", false)
end
rs.setOutput("front", true)
rs.setOutput("top", true)
turtle.turnRight()
turtle.turnLeft()
while 12 < turtle.getFuelLevel() do
if redstone.getInput("front") then
cutDownTree()
end
wait()
end