Advertisement
Semior001

tt

Jan 6th, 2020
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. length = 6
  2. width = 5
  3. height = 5
  4.  
  5. -- getting the neccessary amount of fuel
  6. success = turtle.refuel(math.ceil(length * height * width / 160))
  7. if not success then
  8. print("place the fuel to the active slot")
  9. exit()
  10. end
  11.  
  12. -- [[ main code ]] --
  13. length = length - 1
  14. width = width - 1
  15. height = height - 1
  16.  
  17. h = 0
  18. repeat
  19. local j = 0
  20. repeat
  21. local i = 0
  22. repeat
  23. turtle.dig()
  24. turtle.forward()
  25. i = i + 1
  26. until (h % 2 == 0 and i >= width) or (h % 2 ~= 0 and i >= length)
  27.  
  28. if j % 2 == 0 and ((h % 2 == 0 and j < length) or (h % 2 ~= 0 and j < width)) then
  29. turtle.turnLeft()
  30. turtle.dig()
  31. turtle.forward()
  32. turtle.turnLeft()
  33. elseif ((h % 2 == 0 and j < length) or (h % 2 ~= 0 and j < width)) then
  34. turtle.turnRight()
  35. turtle.dig()
  36. turtle.forward()
  37. turtle.turnRight()
  38. end
  39.  
  40. j = j + 1
  41.  
  42. until (h % 2 == 0 and j >= length + 1) or (h % 2 ~= 0 and j >= width + 1)
  43.  
  44. turtle.digDown()
  45. turtle.down()
  46. if h % 2 == 0 then
  47. if width % 2 == 0 then
  48. turtle.turnLeft()
  49. else
  50. turtle.turnRight()
  51. end
  52. else
  53. if width % 2 == 0 then
  54. turtle.turnRight()
  55. else
  56. turtle.turnLeft()
  57. end
  58. end
  59. h = h + 1
  60. until h == height
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement