Advertisement
Guest User

stairdig.lua

a guest
May 24th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. function digRow(a)
  2. for x=1,a,1 do
  3. turtle.dig()
  4. turtle.forward()
  5. end
  6. end
  7.  
  8. print("Enter length")
  9. l=io.read()
  10.  
  11. print("Enter width")
  12. w=io.read()
  13.  
  14. turtle.digDown()
  15. turtle.down()
  16.  
  17. for y=1,w,1 do
  18. for x=1,l,1 do
  19. digRow(1)
  20. end
  21.  
  22. if (y % 2 == 1) then
  23.     turtle.turnRight()
  24.     turtle.dig()
  25.     turtle.forward()
  26.     turtle.turnRight()
  27. else
  28.     turtle.turnLeft()
  29.     turtle.dig()
  30.     turtle.forward()
  31.     turtle.turnLeft()
  32. end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement