XylianLP

Raum nach unten ausgraben

Jun 12th, 2021
699
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. write("Laenge: ")
  2. l = io.read()
  3.  
  4. write("Breite: ")
  5. b = io.read()
  6.  
  7. write("Tiefe:  ")
  8. h = io.read()
  9.  
  10. local d = "rechts"
  11.  
  12. function vorne()
  13.   while not turtle.forward() do
  14.     turtle.dig()
  15.   end
  16. end
  17.  
  18. function laenge()
  19.   for i=1,l-1 do
  20.     vorne()
  21.   end
  22. end
  23.  
  24. function drehen()
  25.   if d=="rechts" then
  26.     turtle.turnRight()
  27.     vorne()
  28.     turtle.turnRight()
  29.     d = "links"
  30.   else
  31.     turtle.turnLeft()
  32.     vorne()
  33.     turtle.turnLeft()
  34.     d = "rechts"
  35.   end
  36. end
  37.  
  38. function breite()
  39.   laenge()
  40.   for k=1,b-1 do
  41.     drehen()
  42.     laenge()
  43.   end
  44. end
  45.  
  46. function tiefe()
  47.   breite()
  48.   for j=1,h-1 do
  49.     turtle.turnRight()
  50.     turtle.turnRight()
  51.     while not turtle.down() do
  52.       turtle.digDown()
  53.     end
  54.     breite()
  55.   end
  56. end
  57.  
  58. tiefe()
RAW Paste Data