Advertisement
Guest User

move

a guest
Feb 19th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. local robot = require ("robot")
  2.  
  3. wall = 1
  4. step = 0
  5.  
  6. function robot.step()
  7.   repeat
  8.     if step < wall then
  9.       robot.forward()
  10.       step = step+1
  11.       os.sleep(2)
  12.     end
  13.   until step == wall
  14.   print("Length reached, turning right")
  15.   robot.turnRight()
  16.   step = 0
  17.   repeat
  18.     if step < wall then
  19.       robot.forward()
  20.       step = step + 1
  21.       os.sleep(2)
  22.     end
  23.   until step == wall
  24.   wall = wall+1      
  25. end
  26.  
  27. repeat
  28.  robot.step()
  29. until false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement