Advertisement
Johndorian

Untitled

May 10th, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. rijtje = 1 -- hoeveel rijen al zijn gedaan op dat level
  2. line = 1 -- 1 of 0 voor directie
  3. row = 1 -- hoogte
  4. cycle = 1
  5.  
  6. -- Goes down
  7. function godown()
  8. turtle.digDown()
  9. turtle.down()
  10. if cycle == 1 then
  11. turtle.turnRight()
  12. turtle.turnRight()
  13. cycle = 0
  14. elseif cycle == 0 then
  15. turtle.turnLeft()
  16. turtle.turnLeft()
  17. cycle = 1
  18. end
  19. rijtje = 1
  20. row = row + 1
  21. platform()
  22. end
  23.  
  24. -- Goes straight ahead
  25.  
  26. function forward()
  27. turtle.dig()
  28. turtle.forward()
  29. end
  30.  
  31. -- Turns right
  32.  
  33. function turnright()
  34. turtle.turnRight()
  35. forward()
  36. turtle.turnRight()
  37. end
  38.  
  39. -- Turns left
  40.  
  41. function turnleft()
  42. turtle.turnLeft()
  43. forward()
  44. turtle.turnLeft()
  45. end
  46.  
  47. -- Choose left or right
  48.  
  49. function direction()
  50. if line == 1 then
  51. turnright()
  52. line = 0
  53. elseif line == 0 then
  54. turnleft()
  55. line = 1
  56. end
  57. initial()
  58. end
  59.  
  60.  
  61.  
  62. function platform()
  63. i = 1
  64. while i < 5 and row < 10 do
  65. forward()
  66. i = i + 1
  67. if i == 5 and row <= 10 and rijtje == 5 then
  68. line = 1
  69. godown()
  70. end
  71. end
  72. if row == 9 then
  73. shell.run("info.lua")
  74. end
  75. rijtje = rijtje + 1
  76. direction()
  77. end
  78.  
  79. function initial()
  80. while rijtje <= 5 do
  81. platform()
  82. rijtje = rijtje + 1
  83. end
  84. rijtje = 1 -- new test
  85. end
  86.  
  87. initial()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement