SHARE
TWEET

floor

a guest May 25th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local taille = ...
  2. local mode = false
  3. local sens = false
  4. if taille % 2 == 0 then
  5.     mode = true
  6.    
  7. end
  8. local emplacement = 1
  9. turtle.select(emplacement)
  10. local function verif()
  11. local inv = turtle.getItemCount(emplacement)
  12. if inv == 0 then
  13.     if emplacement < 16 then
  14.         turtle.select(emplacement+1)
  15.         emplacement = emplacement+1
  16.     else
  17.         turtle.select(1)
  18.     end
  19. end
  20. end
  21. local function av()  while not turtle.forward()   do end end
  22. local function rb()  while not turtle.back()      do end end
  23. local function mt()  while not turtle.up()        do end end
  24. local function ds()  while not turtle.down()      do end end
  25. local function ga()  while not turtle.turnLeft()  do end end
  26. local function dr()  while not turtle.turnRight() do end end
  27. local function cr()  turtle.dig()       end
  28. local function ucr()  turtle.digUp()     end
  29. local function dcr()  turtle.digDown()   end
  30. local function p()  turtle.place()     end
  31. local function pu()  turtle.placeUp()   end
  32. local function pd()  turtle.placeDown() end
  33. local function ss(s) turtle.select(s)   end
  34.  
  35. --cycle
  36. local i = 0
  37. while i < taille-1 do
  38. av()
  39. i=i+1
  40. end
  41. if not mode then
  42.         while i < (tonumber(taille)-1) do
  43.         av()
  44.         i=i+1
  45.     end
  46. else
  47. ga()   
  48. end
  49. local i = 0
  50. repeat
  51. local j = 0
  52.  
  53. repeat
  54.     rb()
  55. verif()
  56. p()
  57.     j = j+1
  58. until j == (tonumber(taille)-1)
  59. if sens then
  60. ga()
  61. sens = false
  62. else
  63. dr()
  64. sens = true
  65. end
  66. rb()
  67. verif()
  68. p()
  69. if sens then
  70. dr()
  71. else
  72. ga()
  73. end
  74. i=i+1
  75. until i == (tonumber(taille))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top