Advertisement
suken27

test1.lua

Mar 24th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. local robot = require("robot")
  2.  
  3. function forceForward()
  4.     if(robot.detect()) then
  5.         robot.swing()
  6.     end
  7.     robot.forward()
  8. end
  9.  
  10. local i = 0
  11.  
  12. for i=1, 2, 1 do
  13.     robot.up()
  14. end
  15.  
  16. for i=0, 101, 1 do
  17.     robot.swingUp()
  18.     forceForward()
  19. end
  20.  
  21. robot.swingUp()
  22.  
  23. robot.turnLeft()
  24. forceForward()
  25. robot.turnLeft()
  26.  
  27. for i=0, 101, 1 do
  28.     robot.swingUp()
  29.     forceForward()
  30. end
  31.  
  32. robot.swingUp()
  33.  
  34. for i=1, 2, 1 do
  35.     robot.down()
  36. end
  37.  
  38. robot.turnRight()
  39. robot.forward()
  40. robot.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement