Kierra

Untitled

May 26th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. long = 39
  2. larg = 6
  3. balance = 1
  4. fuel = 0
  5. coal = 0
  6. --- Fonctions ---
  7.  
  8. function refuel()
  9. fuel = turtle.getFuelLevel()
  10. if fuel < 10 then
  11. turtle.refuel(2)
  12. end
  13. end
  14.  
  15. function back()
  16. repeat
  17. turtle.forward()
  18. until turtle.detect()
  19. turtle.turnLeft()
  20. end
  21.  
  22. function drop()
  23. turtle.select(2)
  24. turtle.dropDown()
  25. turtle.select(3)
  26. turtle.dropDown()
  27. end
  28.  
  29. function recharge()
  30. turtle.select(1)
  31. coal = turtle.getItemCount(1)
  32. if coal == 0 then
  33. turtle.suckUp()
  34. end
  35. end
  36.  
  37. function longueur()
  38. cache = long
  39. while cache ~= 0 do
  40. turtle.dig()
  41. turtle.forward()
  42. cache = cache - 1
  43. print(cache)
  44. end
  45. cache = long
  46. end
  47.  
  48. function Turn()
  49. if balance < 0 then
  50. turtle.turnRight()
  51. turtle.forward()
  52. turtle.dig()
  53. turtle.forward()
  54. turtle.turnRight()
  55. elseif balance > 0 then
  56. turtle.turnLeft()
  57. turtle.forward()
  58. turtle.dig()
  59. turtle.forward()
  60. turtle.turnLeft()
  61. end
  62. iFAjY7fz
  63. end
  64.  
  65. --- Programme ---
  66.  
  67. recharge()
  68. while larg ~= 0 do
  69. refuel()
  70. longueur()
  71. Turn()
  72. larg = larg - 1
  73. end
  74.  
  75. repeat
  76. turtle.forward()
  77. until turtle.detect()
  78. turtle.turnRight()
  79. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment