davial

Low 3x3 tunnel digger

Jun 13th, 2015
486
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- davial. Low 3x3 tunnel digger alpha 0.02
  2.  
  3. local r = require ("robot")
  4. function Dig()
  5.     r.swing()
  6.     r.forward()
  7.     r.swingUp()
  8.     r.swingDown()
  9. end
  10. function RightHand()
  11.     Dig()
  12.     r.turnRight()
  13.     Dig()
  14.     r.forward()
  15.     Dig()
  16.     r.turnLeft()
  17. end
  18. function LeftHand()
  19.     Dig()
  20.     r.turnLeft()
  21.     Dig()
  22.     r.forward()
  23.     Dig()
  24.     r.turnRight()
  25. end
  26.  
  27. -- Programm --
  28.  
  29. -- .. Length track ..
  30. print (" Input length tunnel ")
  31. len = io.read()
  32.  
  33. -- .. His say : "POYEHALI" ..
  34. r.up()
  35.  
  36. for i = 1, len do
  37.   if i%2~=0 then RightHand()
  38.             else LeftHand()
  39.   end
  40. end
  41.  
  42. r.down()
RAW Paste Data