Created
February 3, 2013 01:05
-
-
Save seriallos/4700035 to your computer and use it in GitHub Desktop.
[ComputerCraft] Redwood Lumberjack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Redwood chopper | |
Place at the base of a redwood tree and let 'er rip | |
--]] | |
turtle.refuel(1) | |
-- dig into the tree one space | |
turtle.dig() | |
turtle.forward() | |
-- figure out if we're on the left or right side of the tree | |
-- check left first | |
turtle.turnLeft() | |
if false == turtle.detect() then | |
turtle.turnRight() | |
end | |
-- chop the current level then move up | |
doneClimbing = false | |
repeat | |
-- first spot is already dug | |
for i = 1, 3 do | |
turtle.dig() | |
turtle.forward() | |
turtle.turnRight() | |
end | |
-- if there's something above, dig it | |
if turtle.detectUp() then | |
turtle.digUp() | |
turtle.up() | |
else | |
-- otherwise we're done | |
doneClimbing = true | |
end | |
until doneClimbing | |
-- safely back to the ground | |
while false == turtle.detectDown() do | |
turtle.down() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment