SHARE
TWEET

grader

a guest Dec 8th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. local x, y, dir = 0, 1, "R"
  3.  
  4. while x ~= y do  
  5.   if turtle.detect()
  6.     then
  7.       turtle.dig()
  8.       turtle.forward()
  9.     else
  10.       if dir == "R" then
  11.         turtle.turnRight()
  12.         else
  13.         turtle.turnLeft()
  14.       end
  15.       if turtle.detect()
  16.         then
  17.           turtle.dig()
  18.           turtle.forward()
  19.           if dir == "R" then
  20.             turtle.turnRight()
  21.             dir = "L"
  22.           else
  23.             turtle.turnLeft()
  24.             dir = "R"
  25.           end
  26.         else
  27.           x = y
  28.       end
  29.   end
  30. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top