Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lane=0
- write("Length: ")
- length = read()
- function moveForward(length)
- for i = 1, length do
- turtle.forward()
- end
- end
- function switchLanes()
- moveForward(1)
- turtle.turnRight()
- moveForward(2)
- turtle.turnRight()
- end
- function switchLanes2()
- moveForward(1)
- turtle.turnLeft()
- moveForward(4)
- turtle.turnLeft()
- end
- function dig()
- turtle.dig()
- moveForward(1)
- turtle.digDown()
- end
- function home()
- if lane==6 then
- turtle.turnLeft()
- moveForward(18)
- turtle.turnRight()
- lane=0
- end
- end
- function roam()
- lane=lane+1
- for i = 1, length do
- if turtle.detect() then
- dig()
- else
- moveForward(1)
- end
- end
- if lane%2==0 then
- switchLanes2()
- else
- switchLanes()
- end
- home()
- sleep(1)
- end
- turtle.up()
- turtle.up()
- while true do
- roam()
- sleep(60)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement