Advertisement
Lupino

Untitled

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