Advertisement
Guest User

Untitled

a guest
Feb 19th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.   robot.turnRight()
  25.   wall = wall+1      
  26. end
  27.  
  28. repeat
  29.  robot.step()
  30. until false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement