rater193_james

OC Basic Tunnel

Dec 17th, 2016
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. local robot = require("robot")
  2. local args = {...}
  3.  
  4.  
  5. function left()
  6.   robot.turnLeft()
  7. end
  8.  
  9. function right()
  10.   robot.turnRight()
  11. end
  12.  
  13. function forward()
  14.   robot.forward()
  15. end
  16.  
  17. function up()
  18.   robot.up()
  19. end
  20.  
  21. function down()
  22.   robot.down()
  23. end
  24.  
  25. function dig()
  26.   robot.swing()
  27. end
  28.  
  29. function digUp()
  30.   robot.swingUp()
  31. end
  32.  
  33. function refuel()
  34.  
  35. end
  36.  
  37. local reptimes = tonumber(args[1])
  38. function loop()
  39.   digUp()
  40.   left()
  41.   dig()
  42.   up()
  43.   dig()
  44.   right()
  45.   right()
  46.   dig()
  47.   down()
  48.   dig()
  49.   left()
  50. end
  51.  
  52. while (reptimes > 1) do
  53.   loop()
  54.   dig()
  55.   forward()
  56.   os.sleep(0.1)
  57.   reptimes = reptimes-1
  58. end
  59. loop()
Advertisement
Add Comment
Please, Sign In to add comment