Advertisement
bob558

3x3-m-litl

Aug 4th, 2015
209
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tArgs = {...}
  2.  
  3. if #tArgs ~= 1 then
  4. print('Usage: tunnel <lenght>')
  5. os.exit()
  6. end
  7.  
  8. local r = require('component').robot
  9.  
  10. local function dig(s)
  11. while r.detect(s) do r.swing(s) end os.sleep(0.1)
  12. end
  13.  
  14. for i = 1, tArgs[1] do
  15. dig(3)
  16. r.move(3)
  17. r.turn(false)
  18. for j = 1, 2 do
  19. dig(3)
  20. dig(1)
  21. r.move(1)
  22. dig(3)
  23. end
  24. r.turn(false)
  25. r.turn(false)
  26. for k = 1, 2 do
  27. dig(3)
  28. dig(0)
  29. r.move(0)
  30. dig(3)
  31. end
  32. r.turn(false)
  33. end
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement