Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. function mydig()
  2. if turtle.detect() then
  3. turtle.dig()
  4. end
  5. turtle.forward()
  6. end
  7.  
  8. function mydigdown()
  9. if turtle.detectDown() then
  10. turtle.digDown()
  11. end
  12. turtle.down()
  13. end
  14.  
  15. function fuelcheck()
  16. if turtle.getFuelLevel() < 1 then
  17. turtle.refuel()
  18. end
  19. end
  20.  
  21. function strip(y,rightshift)
  22. -- From center dig to y
  23. for i=0,y do
  24. mydig()
  25. end
  26. for i=0,y do
  27. turtle.back()
  28. end
  29.  
  30. turtle.turnLeft()
  31. turtle.turnLeft()
  32.  
  33. for i=0,y do
  34. mydig()
  35. end
  36. for i=0,y do
  37. turtle.back()
  38. end
  39.  
  40. turtle.turnLeft()
  41. turtle.turnLeft()
  42.  
  43. if( rightshift ) then
  44. turtle.turnRight()
  45. mydig()
  46. turtle.turnLeft()
  47. end
  48. end
  49.  
  50. function octet ( radius )
  51.  
  52. x = 0
  53. y = radius
  54. p = 1 - radius
  55.  
  56. i = 0
  57. lower_octet = {}
  58.  
  59. while( x < y ) do
  60.  
  61. if( p < 0 ) then
  62. p = p + (2*x+2) + 1
  63. x = x + 1
  64. else
  65. p = p + (2*x+2) + 1 - (2*y-2)
  66. x = x + 1
  67. y = y - 1
  68. end
  69.  
  70. print("(" .. x .. "," .. y .. ")")
  71. strip(y, false)
  72.  
  73. lower_octet[i] = { y, x }
  74. i = i+1
  75. end
  76. print("-------");
  77.  
  78. i = i - 1
  79.  
  80. while( i >= 0 ) do
  81. print("(" .. lower_octet[i][1] .. "," .. lower_octet[i][2] .. ")")
  82. rightshift = true
  83. if( i== 0 ) then
  84. rightshift = false
  85. end
  86. strip(lower_octet[i][2], rightshift )
  87. i = i - 1
  88. end
  89. end
  90.  
  91. radius = 6
  92. fuelcheck()
  93.  
  94. octet( radius ) -- dig to the right
  95.  
  96. turtle.turnLeft()
  97.  
  98. for i=0,radius do
  99. turtle.forward()
  100. end
  101.  
  102. turtle.turnLeft()
  103.  
  104. octet( radius ) -- dig to the left
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement