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.54 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. print( "rightshift:" .. rightshift )
  44. if( rightshift ) then
  45. turtle.turnRight()
  46. mydig()
  47. turtle.turnLeft()
  48. end
  49. end
  50.  
  51. function octet ( radius )
  52.  
  53. x = 0
  54. y = radius
  55. p = 1 - radius
  56.  
  57. i = 0
  58. lower_octet = {}
  59.  
  60. while( x < y ) do
  61.  
  62. if( p < 0 ) then
  63. p = p + (2*x+2) + 1
  64. x = x + 1
  65. else
  66. p = p + (2*x+2) + 1 - (2*y-2)
  67. x = x + 1
  68. y = y - 1
  69. end
  70.  
  71. print("(" .. x .. "," .. y .. ")")
  72. strip(y, false)
  73.  
  74. lower_octet[i] = { y, x }
  75. i = i+1
  76. end
  77. print("-------");
  78.  
  79. i = i - 1
  80.  
  81. while( i >= 0 ) do
  82. print("(" .. lower_octet[i][1] .. "," .. lower_octet[i][2] .. ")")
  83. rightshift = true
  84. if( i== 0 ) then
  85. rightshift = false
  86. end
  87. strip(lower_octet[i][2], rightshift )
  88. i = i - 1
  89. end
  90. end
  91.  
  92. radius = 6
  93. fuelcheck()
  94.  
  95. octet( radius ) -- dig to the right
  96.  
  97. turtle.turnLeft()
  98.  
  99. for i=0,radius do
  100. turtle.forward()
  101. end
  102.  
  103. turtle.turnLeft()
  104.  
  105. octet( radius ) -- dig to the left
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement