Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. function digForward(weite)
  2. for aktuelleweite = 0, weite, 1 do
  3. turtle.dig()
  4. turtle.forward()
  5. if turtle.detectDown() == false then
  6. turtle.select(1)
  7. turtle.placeDown()
  8. end
  9. end
  10. end
  11.  
  12.  
  13. function nextLineLeft()
  14. turtle.turnLeft()
  15. turtle.dig()
  16. turtle.forward()
  17. if turtle.detectDown() == false then
  18. turtle.select(1)
  19. turtle.placeDown()
  20. end
  21. turtle.turnLeft()
  22. end
  23.  
  24. function nextLineRight()
  25. turtle.turnRight()
  26. turtle.dig()
  27. turtle.forward()
  28. if turtle.detectDown() == false then
  29. turtle.select(1)
  30. turtle.placeDown()
  31. end
  32. turtle.turnRight()
  33. end
  34.  
  35. function getSize()
  36. shell.run("clear")
  37. write("Bitte gebe die Breite ein:")
  38. breite = io.read()
  39. write("Bitte gebe die Tiefe ein:")
  40. tiefe = io.read()
  41. write("Bitte gebe die Hoehe ein:")
  42. hoehe = io.read()
  43. end
  44.  
  45. function startMine()
  46. for i = 0, breite-1, 1 do
  47. digForward(tiefe-1)
  48. if i == 0 then
  49. nextLineLeft()
  50. end
  51. if i == 1 then
  52. nextLineRight()
  53. end
  54. if i >= 2 then
  55. if i % 2 == 0 then
  56. nextLineLeft()
  57. end
  58. if i % 2 > 0 then
  59. nextLineRight()
  60. end
  61. end
  62. end
  63. end
  64.  
  65.  
  66.  
  67. function main()
  68. option = "n"
  69. getSize()
  70. print("Soll ein bereich von:")
  71. print("X: "..breite.." Z:"..tiefe.." Y:"..hoehe)
  72. write("ausgehoben werden? y/n> ")
  73. option = io.read()
  74.  
  75. if option == "y" then
  76. startMine()
  77. end
  78. end
  79.  
  80. breite = 0
  81. tiefe = 0
  82. hoehe = 0
  83.  
  84. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement