Skip to content

Instantly share code, notes, and snippets.

@wolfgangmeyers
Last active August 29, 2015 14:17
Show Gist options
  • Save wolfgangmeyers/5894095433ce96596a85 to your computer and use it in GitHub Desktop.
Save wolfgangmeyers/5894095433ce96596a85 to your computer and use it in GitHub Desktop.
Computercraft turtle script for carving out paths
-- navigate through a path
function digDown()
while not turtle.down() do
turtle.digDown()
end
end
function digUp()
while not turtle.up() do
turtle.digUp()
end
end
function dig()
while not turtle.forward() do
turtle.dig()
end
end
pathmap = {
w=dig,
a=turtle.turnLeft,
d=turtle.turnRight,
r=digUp,
f=digDown
}
function nav(path)
for i=1,string.len(path) do
command = string.sub(path, i, i)
while not pathmap[command]() do
digmap[command]()
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment