Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. round = 1
  2. max = 5
  3.  
  4. function pickUp()
  5. for i = 0, 5 do turtle.suck(99) end
  6. for i = 0, 5 do turtle.suckUp(99) end
  7. for i = 0, 5 do turtle.suckDown(99) end
  8. end
  9.  
  10. while (round < max) do
  11. for rot = 0, 3 do
  12. print("rot", rot)
  13. -- First, up
  14. success, data = turtle.detectUp()
  15. if success then
  16. if string.match(data["name"], "ore") then
  17. turtle.digUp()
  18. sleep(1)
  19. pickUp()
  20. end
  21. end
  22.  
  23. -- Next, down
  24. success, data = turtle.detectUp()
  25. if success then
  26. if string.match(data["name"], "ore") then
  27. turtle.digUp()
  28. sleep(1)
  29. pickUp()
  30. end
  31. end
  32.  
  33. -- Last, forward
  34. success, data = turtle.detectUp()
  35. if success then
  36. if string.match(data["name"], "ore") then
  37. turtle.digUp()
  38. sleep(1)
  39. pickUp()
  40. end
  41. end
  42.  
  43. -- Move forward
  44. turtle.forward()
  45. end
  46.  
  47. round = round + 1
  48. turtle.turnLeft()
  49. print("Round", round, "done")
  50. end
  51.  
  52. print("Done!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement