Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local x = 1
- local y = 1
- local z = 1
- local function backD(distance)
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,distance do
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- z = z - 1
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- local function rightD(distance)
- turtle.turnRight()
- for i=1,distance do
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- x = x - 1
- end
- turtle.turnLeft()
- end
- local function leftD(distance)
- turtle.turnLeft()
- for i=1,distance do
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- x = x + 1
- end
- turtle.turnRight()
- end
- local function forwardD(distance)
- for i=1,distance do
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- z = z + 1
- end
- end
- local function downD(distance)
- for i=1,distance do
- if turtle.detectDown() then
- turtle.digDown()
- end
- y = y - 1
- turtle.down()
- end
- end
- local function upD(distance)
- for i=1,distance do
- if turtle.detectUp() then
- turtle.digUp()
- end
- y = y + 1
- turtle.up()
- end
- end
- local xoff = 1
- local yoff = 1
- local zoff = 1
- local movingForward = true
- local movingLeft = false
- while true do
- -- navigation sysstem
- -- this number must be even for this to work
- if zoff == 4 then
- if movingForward then
- movingForward = false
- movingLeft = true
- zoff = 1
- rightD(3)
- forwardD(1)
- else
- movingForward = true
- movingLeft = false
- zoff = 1
- rightD(3)
- backD(1)
- end
- xoff = xoff + 1
- else
- if movingLeft then
- leftD(1)
- else
- rightD(1)
- end
- if movingForward then
- forwardD(2)
- else
- backD(2)
- end
- if movingLeft then
- movingLeft = false
- else
- movingLeft = true
- end
- zoff = zoff + 1
- end
- turtle.digDown()
- end
Advertisement
Add Comment
Please, Sign In to add comment