Skip to content

Instantly share code, notes, and snippets.

@dillmo
Last active August 29, 2015 13:56
Show Gist options
  • Save dillmo/9156498 to your computer and use it in GitHub Desktop.
Save dillmo/9156498 to your computer and use it in GitHub Desktop.
A ComputerCraft program to perforate tunnel walls with lit tunnels, in order to expose ores
--[[ Branch Miner by dillmo
----------------------
Begin by placing the turtle facing forward two blocks three blocks before
the next strip. If you have already started, this is at the end of the
last strip. Next, place torches in slot one of the turtle's inventory and
cobblestone in the second. Finally, specify your preferences in
Customization and run the program. The turtle will continue until it
reaches the end of your main tunnel.
--]]
-- Customization
local side='left' -- Side the turtle mines on; it can be left or right
-- Program
local function turnAround()
turtle.turnRight()
turtle.turnRight()
end
print('Starting mining')
turtle.forward()
turtle.forward()
repeat
turtle.forward()
if side == 'left' then
turtle.turnLeft()
elseif side == 'right' then
turtle.turnRight()
else
print('Error: side not properly specified')
break
end
for i=0, 6 do
while turtle.detect() do
turtle.dig()
end
turtle.digUp()
turtle.forward()
if not turtle.detectDown() then
turtle.select(2)
turtle.placeDown()
end
end
turtle.digUp()
turtle.up()
turtle.select(1)
turtle.placeDown()
turnAround()
turtle.forward()
if turtle.detectDown() then
turtle.digDown()
end
turtle.down()
for i=0, 5 do
while turtle.detect() do
turtle.dig()
end
turtle.forward()
end
if side == 'left' then
turtle.turnLeft()
elseif side == 'right' then
turtle.turnRight()
else
print('Error: side not properly specified')
break
end
turtle.forward()
turtle.forward()
until turtle.detect()
print('Done mining')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment