Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local INV_SIZE = 16;
- local DIG_LENGTH = 25;
- function refuel() if turtle.getFuelLevel() < 5000 then turtle.refuel() end end
- function digColumn()
- turtle.dig()
- print("Trying to move forward")
- turtle.forward()
- turtle.digDown()
- turtle.digUp()
- end
- function digTunnel()
- for i = 0, DIG_LENGTH, 1 do
- digColumn()
- end
- end
- function forward(squares) for i = 0, squares, 1 do turtle.forward() end end
- function digSquare()
- for i = 0, 4, 1 do
- print("Digging tunnel")
- digTunnel()
- turtle.turnRight()
- end
- end
- function zigZag()
- local nTunnels = math.floor(DIG_LENGTH / 3)
- local direction = 'right'
- for i = 0, nTunnels, 1 do
- if direction == 'right' then
- forward(3)
- turtle.turnRight()
- digTunnel()
- turtle.turnLeft()
- direction = 'left'
- end
- if direction == 'left' then
- forward(3)
- turtle.turnLeft()
- digTunnel()
- turtle.turnRight()
- direction = 'right'
- end
- end
- end
- function main()
- print("Turtle:")
- print(turtle)
- print("------")
- refuel()
- digSquare()
- zigZag()
- end
- main()
Add Comment
Please, Sign In to add comment