Kierra

Untitled

May 26th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 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.  
  28. function recharge()
  29. turtle.select(1)
  30. coal = turtle.getItemCount(1)
  31. if coal == 0 then
  32. turtle.suckUp()
  33. end
  34. end
  35.  
  36. function longueur()
  37. cache = long
  38. while cache ~= 0 do
  39. turtle.dig()
  40. turtle.forward()
  41. cache = cache - 1
  42. print(cache)
  43. end
  44. cache = long
  45. balance = balance * (-1)
  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. end
  63.  
  64. --- Programme ---
  65.  
  66. recharge()
  67. while larg ~= 0 do
  68. refuel()
  69. longueur()
  70. Turn()
  71. larg = larg - 1
  72. end
  73.  
  74. repeat
  75. turtle.forward()
  76. until turtle.detect()
  77. turtle.turnRight()
  78. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment