Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tunnelLengthMax = 32
- turn = 1
- tunnelLengthCurrent = tunnelLengthMax
- placeTorch = 10
- kill = 0
- ending = false
- function left()
- turtle.turnLeft()
- end
- function right()
- turtle.turnRight()
- end
- function moveForward()
- while turtle.detect() do
- turtle.dig()
- end
- moved = false
- while not(moved) do
- moved = turtle.forward()
- end
- end
- function digForward()
- while turtle.detect() do
- turtle.dig()
- end
- end
- function digBelow()
- while turtle.detectDown() do
- turtle.digDown()
- end
- end
- function digAbove()
- while turtle.detectUp() do
- turtle.digUp()
- end
- end
- function moveUp()
- turtle.digUp()
- moved = false
- while not(moved) do
- turtle.up()
- moved = turtle.up()
- end
- end
- function moveDown()
- turtle.digDown()
- moved = false
- while not(moved) do
- moved = turtle.down()
- end
- end
- function leftDig()
- turtle.turnLeft()
- moveForward()
- digAbove()
- digBelow()
- turtle.turnLeft()
- end
- function rightDig()
- turtle.turnRight()
- moveForward()
- digAbove()
- digBelow()
- turtle.turnRight()
- end
- while true do
- if tunnelLengthCurrent > 0 and ending == false then
- moveForward()
- digAbove()
- digBelow()
- placeTorch = placeTorch - 1
- tunnelLengthCurrent = tunnelLengthCurrent - 1
- if placeTorch <= 0 then
- placeTorch = 10
- turtle.placeDown()
- end
- end
- if tunnelLengthCurrent <= 0 and turn == 1 then
- rightDig()
- tunnelLengthCurrent = tunnelLengthMax
- kill = kill + 1
- turn = 2
- end
- if tunnelLengthCurrent <= 0 and turn == 2 then
- leftDig()
- tunnelLengthCurrent = tunnelLengthMax
- kill = kill + 1
- turn = 3
- end
- if tunnelLengthCurrent <= 0 and turn == 3 then
- tunnelLengthCurrent = tunnelLengthMax
- leftDig()
- right()
- moveForward()
- left()
- while tunnelLengthCurrent > 0 do
- moveForward()
- tunnelLengthCurrent = tunnelLengthCurrent - 1
- end
- kill = 3
- turn = 4
- end
- if kill == 3 then
- error()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement