Advertisement
Guest User

c

a guest
Aug 29th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. x = 0
  2. t = 0
  3. cyclet = 0
  4. cycles = 0
  5. print("x is "..x)
  6. print("t is "..t)
  7. print("cyclet is "..cyclet)
  8. print("cycles are "..cycles)
  9.  
  10. function main()
  11. if x < 8 then
  12. while x < 8 do
  13. turtle.dig()
  14. turtle.forward()
  15. x = x + 1
  16. end
  17. end
  18. end
  19.  
  20. function cycleCounter()
  21. if x == 8 then
  22. cycles = cycles + 1
  23. print(cycles)
  24. end
  25. end
  26.  
  27. function turn()
  28. if x == 8 and cyclet == 0 then
  29. if t == 0 then
  30. while x == 8 do
  31. print("turn one")
  32. turtle.turnRight()
  33. turtle.dig()
  34. turtle.forward()
  35. turtle.turnRight()
  36. x = 0
  37. t = 1
  38. end
  39. end
  40. end
  41. end
  42.  
  43.  
  44. function turnTwo()
  45. if x == 8 and cyclet == 0 then
  46. if t == 1 then
  47. while x == 8 do
  48. print("turn two")
  49. turtle.turnLeft()
  50. turtle.dig()
  51. turtle.forward()
  52. turtle.turnLeft()
  53. x = 0
  54. t = 0
  55. end
  56. end
  57. end
  58. end
  59.  
  60.  
  61. function endCycle()
  62. if cycles == 8 then
  63. turtle.digDown()
  64. turtle.down()
  65. turtle.turnLeft()
  66. turtle.turnLeft()
  67. cycles = 0
  68. t = 0
  69. x = 0
  70. print("new cycle")
  71. if cyclet == 0 then
  72. cyclet = 1
  73. else
  74. cyclet = 0
  75. end
  76. end
  77. end
  78.  
  79. function turnThree()
  80. if x == 8 and cyclet == 1  then
  81. if t == 0 then
  82. while x == 8 do
  83. print("turn three")
  84. turtle.turnLeft()
  85. turtle.dig()
  86. turtle.forward()
  87. turtle.turnLeft()
  88. x = 0
  89. t = 1
  90. end
  91. end
  92. end
  93. end
  94.  
  95.  
  96. function turnFour()
  97. if x == 8 then and cyclet == 1 then
  98. if t == 1 then
  99. while x == 8 do
  100. print("turn four")
  101. turtle.turnRight()
  102. turtle.dig()
  103. turtle.forward()
  104. turtle.turnRight()
  105. x = 0
  106. t = 0
  107. end
  108. end
  109. end
  110. end
  111.  
  112.  
  113. while true do
  114. main()
  115. cycleCounter()
  116. endCycle()
  117. turn()
  118. turnTwo()
  119. turnThree()
  120. turnFour()
  121. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement