Advertisement
ajthemacboy

Random Movement

Jan 28th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.   end
  25.  end
  26.  
  27.  if action == 5 then
  28.   local distance = math.random(1,5)
  29.   for i = 1,distance do
  30.    turtle.forward()
  31.   end
  32.  end
  33.  
  34.  if action == 6 then
  35.   local distance = math.random(1,5)
  36.   for i = 1,distance do
  37.    turtle.forward()
  38.   end
  39.  end
  40.  
  41.  if action == 7 then
  42.   local distance = math.random(1,5)
  43.   for i = 1,distance do
  44.    turtle.up()
  45.   end
  46.  end
  47.  
  48.  if action == 8 then
  49.   local distance = math.random(1,5)
  50.   for i = 1,distance do
  51.    turtle.down()
  52.   end
  53.  end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement