Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. local location = {}
  2. local position = {}
  3. local size ={}
  4. local maxNum = 0
  5.  
  6. function main()
  7. position[0] = -1
  8. position[1] = -1
  9. position[2] = -1
  10.  
  11. print("Reihe,Stapel,Platz")
  12. size[0] = read()
  13. size[1] = read()
  14. size[2] = read()
  15.  
  16. maxNum = size[0]*size[1]*size[2]
  17.  
  18. for i=, maxNum-1 do
  19. location[i]="Nil"
  20. end
  21.  
  22. while true do
  23. print("e:Zum Einlagern a:Zum Auslagern")
  24. local input = read()
  25. if input == "e" then
  26. print("Name in Kleinbuchstaben:")
  27. input = read()
  28. local place = -1
  29. for i=0 maxNum-1 do
  30. if location[i] == input then
  31. place = i
  32. end
  33. end
  34.  
  35. if place == -1 then
  36. for i=0 maxNum-1 do
  37. if location[i] == "Nil" then
  38. place = i
  39. end
  40. end
  41. end
  42.  
  43. if place == -1 then
  44. print("Das Lager ist Voll")
  45. else
  46. local r = 0
  47. local s = 0
  48. local p = 0
  49.  
  50. if place >= 12 then
  51. r = math.floor(place/size[0])
  52. place = place - size[0]*r
  53. end
  54.  
  55. if place >=3 then
  56. s = math.floor(place/3)
  57. place = place -
  58.  
  59.  
  60.  
  61. end
  62. elseif input == "a" then
  63. reset()
  64. end
  65. end
  66. end
  67.  
  68.  
  69. function move(pReihe,pStapel,pPlatz)
  70. for i = 0, pReihe do
  71. turtle.forward()
  72. turtle.forward()
  73. end
  74.  
  75. turtle.turnRight()
  76.  
  77. for i = 0, pStapel do
  78. turtle.forward()
  79. turtle.forward()
  80. turtle.forward()
  81. end
  82.  
  83. turtle.turnRight()
  84.  
  85. for i = 0, pPlatz do
  86. turtle.up()
  87. turtle.up()
  88. end
  89.  
  90. position[0] = pReihe
  91. position[1] = pStapel
  92. position[2] = pPlatz
  93. end
  94.  
  95. function reset()
  96. if position[x] == -1 or position[y] == -1 or position[z] == -1 then
  97. return
  98. end
  99.  
  100. for i = 0, position[2] do
  101. turtle.down()
  102. turtle.down()
  103. end
  104.  
  105. turtle.turnRight()
  106.  
  107. for i = 0, position[1] do
  108. turtle.forward()
  109. turtle.forward()
  110. turtle.forward()
  111. end
  112.  
  113. turtle.turnLeft()
  114.  
  115. for i = 0, position[0] do
  116. turtle.forward()
  117. turtle.forward()
  118. end
  119.  
  120. turtle.turnRight()
  121. turtle.turnRight()
  122. end
  123.  
  124.  
  125. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement