Advertisement
PSquishyP

CC Turtle Quarry

Sep 1st, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. function square(size)
  2. n = 0
  3.  
  4. size = size - 1
  5.  
  6. for i = 0,size,1 do
  7.  
  8. for i = 0,size,1 do
  9. turtle.digDown()
  10. turtle.forward()
  11. end
  12.  
  13. n = n + 1
  14.  
  15. if turtle.detect() then
  16. addM = false
  17. else
  18. addM = true
  19. end
  20.  
  21. if n%2 == 0 then
  22. turtle.turnLeft()
  23. turtle.forward()
  24. turtle.turnLeft()
  25. if addM then
  26. turtle.forward()
  27. end
  28. else
  29. turtle.turnRight()
  30. turtle.forward()
  31. turtle.turnRight()
  32. if addM then
  33. turtle.forward()
  34. end
  35. end
  36. end
  37.  
  38. if n%2 == 0 then
  39. turtle.turnLeft()
  40. for i = 0,size,1 do
  41. turtle.forward()
  42. end
  43. turtle.turnRight()
  44. for i = 0,size-1,1 do
  45. turtle.forward()
  46. end
  47. turtle.turnRight()
  48. turtle.turnRight()
  49. else
  50. turtle.turnRight()
  51. for i = 0,size,1 do
  52. turtle.forward()
  53. end
  54. turtle.turnLeft()
  55. for i = 0,size-1,1 do
  56. turtle.forward()
  57. end
  58. turtle.turnLeft()
  59. turtle.turnLeft()
  60. end
  61. end
  62.  
  63. while true do
  64. square(3)
  65. turtle.down()
  66. sleep(0)
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement