Advertisement
ajthemacboy

Random 2

Jan 28th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. while true do
  2. local action = math.random(1,8)
  3.  
  4.  
  5. if action == 1 then
  6. turtle.turnLeft()
  7. end
  8.  
  9. if action == 2 then
  10. turtle.turnRight()
  11. end
  12.  
  13. if action == 3 then
  14. local distance = math.random(1,5)
  15. for i = 1,distance do
  16. turtle.forward()
  17. end
  18. end
  19.  
  20. if action == 4 then
  21. local distance = math.random(1,5)
  22. for i = 1,distance do
  23. turtle.forward()
  24. if turtle.detectDown() then
  25. turtle.select(1)
  26. else
  27. turtle.down()
  28. end
  29. end
  30. end
  31.  
  32. if action == 5 then
  33. local distance = math.random(1,5)
  34. for i = 1,distance do
  35. turtle.forward()
  36. if turtle.detectDown() then
  37. turtle.select(1)
  38. else
  39. turtle.down()
  40. end
  41. end
  42. end
  43.  
  44. if action == 6 then
  45. local distance = math.random(1,5)
  46. for i = 1,distance do
  47. turtle.forward()
  48. if turtle.detectDown() then
  49. turtle.select(1)
  50. else
  51. turtle.down()
  52. end
  53. end
  54. end
  55.  
  56. if action == 7 then
  57. local distance = math.random(1,5)
  58. for i = 1,distance do
  59. turtle.up()
  60. end
  61. end
  62.  
  63. if action == 8 then
  64. local distance = math.random(1,5)
  65. for i = 1,distance do
  66. turtle.down()
  67. end
  68. end
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement