Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lane=0
  2. write("Length: ")
  3. length = read()
  4. function moveForward(length)
  5.   for i = 1, length do
  6.         turtle.forward()
  7.   end
  8. end
  9. function switchLanes()
  10.   moveForward(1)
  11.   turtle.turnRight()
  12.   moveForward(2)
  13.   turtle.turnRight()
  14. end
  15. function switchLanes2()
  16.   moveForward(1)
  17.   turtle.turnLeft()
  18.   moveForward(4)
  19.   turtle.turnLeft()
  20. end
  21. function dig()
  22.   turtle.dig()
  23.   moveForward(1)
  24.   turtle.digDown()
  25. end
  26. function home()
  27.     if lane==6 then
  28.         turtle.turnLeft()
  29.         moveForward(18)
  30.         turtle.turnRight()
  31.         lane=0
  32.     end
  33. end
  34. function roam()
  35.   lane=lane+1
  36.   for i = 1, length do
  37.         if turtle.detect() then
  38.           dig()
  39.         else
  40.          moveForward(1)
  41.         end
  42.   end
  43.   if lane%2==0 then
  44.     switchLanes2()
  45.   else
  46.     switchLanes()
  47.   end
  48.   home()
  49.   sleep(1)
  50. end
  51.  
  52. turtle.up()
  53. turtle.up()
  54.  
  55. while true do
  56.   roam()
  57.   sleep(60)
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement