Advertisement
mikemking

Flatten

Nov 27th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local arg = {...}
  2. local max_x = tonumber(arg[1])
  3. local max_y = tonumber(arg[2])
  4.  
  5. local cur_x = 0
  6. local cur_y = 0
  7.  
  8. for cur_x = 0, max_x, 2 do
  9.     -- move up on y axis
  10.     for cur_y = 0, max_y, 1 do
  11.         if (turtle.detect()) then
  12.             turtle.dig()
  13.         end
  14.         turtle.forward()
  15.     end
  16.    
  17.     -- move over, turn backward
  18.     turtle.turnRight()
  19.     if (turtle.detect()) then
  20.         turtle.dig()
  21.     end
  22.     turtle.forward()
  23.     turtle.turnRight()
  24.  
  25.     for cur_y = cur_y, 0, 1 do
  26.         if (turtle.detect()) then
  27.             turtle.dig()
  28.         end
  29.         turtle.forward()
  30.     end
  31.  
  32.     -- move over, turn backward
  33.     turtle.turnLeft()
  34.     if (turtle.detect()) then
  35.         turtle.dig()
  36.     end
  37.     turtle.forward()
  38.     turtle.turnLeft()
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement