Advertisement
Guest User

startup

a guest
Mar 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.79 KB | None | 0 0
  1. term.setBackgroundColor(colors.gray)
  2. term.setTextColor(colors.black)
  3. term.clear()
  4. term.setBackgroundColor(colors.white)
  5. term.setCursorPos(1, 1)
  6. print("1 2 3")
  7. print("4 5 6")
  8. print("7 8 9")
  9. print("ENTER")
  10. term.setCursorPos(1, 6)
  11. write("Anzahl an Gaengen: ")
  12.  
  13.  
  14.  
  15. IG = 0
  16. GO = 0
  17.  
  18. event, side, x, y = os.pullEvent("mouse_click")
  19. if x == 1 and y == 1 then
  20.   IG = IG + "1"
  21. end
  22. if x == 3 and y == 1 then
  23.   IG = IG + "2"
  24. end
  25. if x == 5 and y == 1 then
  26.   IG = IG + "3"
  27. end
  28. if x == 1 and y == 2 then
  29.   IG = IG +"4"
  30. end
  31. if x == 3 and y == 2 then
  32.   IG = IG + "5"
  33. end
  34. if x == 5 and y == 2 then
  35.   IG = IG + "6"
  36. end
  37. if x == 1 and y == 3 then
  38.   IG = IG + "7"
  39. end
  40. if x == 3 and y == 3 then
  41.   IG = IG + "8"
  42. end
  43. if x == 5 and y == 3 then
  44.   IG = IG + "9"
  45. end
  46.  
  47. print(IG)
  48.  
  49. event, side, x, y = os.pullEvent("mouse_click")
  50. if x > 1 and x < 5 and y == 1 then
  51.   GO = 1
  52. end
  53.  
  54. G = 1
  55. GB = 0
  56. D = 0
  57.  
  58. function Vor()
  59.   while turtle.detect() do
  60.     turtle.dig()
  61.     sleep(0.3)
  62.   end
  63.   if not turtle.detectDown() then
  64.     select(1)
  65.     turtle.placeDown()
  66.   end
  67.     turtle.forward()
  68.       while turtle.detectUp() do
  69.         turtle.digUp()
  70.         sleep(0.3)
  71.       end
  72.         while turtle.detect() do
  73.           turtle.dig()
  74.           sleep(0.3)
  75.         end
  76.         if not turtle.detectDown() then
  77.           select(1)
  78.           turtle.placeDown()
  79.         end
  80.           turtle.forward()
  81.             while turtle.detectUp() do
  82.               turtle.digUp()
  83.               sleep(0.3)
  84.             end
  85. end
  86.  
  87. function Fackel()
  88.   turtle.turnLeft()
  89.   turtle.turnLeft()
  90.   turtle.select(2)
  91.   turtle.place()
  92.   turtle.select(1)
  93.   turtle.turnRight()
  94.   turtle.turnRight()
  95. end
  96.  
  97. function Leeren()
  98.   local i = 3
  99.     for i = 3,16 do
  100.       turtle.select(i)
  101.       turtle.drop(64)
  102.     end
  103.   turtle.select(1)
  104. end
  105.  
  106. function WB()
  107.   while GB ~= 0 do
  108.     turtle.forward()
  109.     GB = GB - 1
  110.   end
  111. end
  112.  
  113. function Gang()
  114.   turtle.turnLeft()
  115.   Vor()
  116.   Vor()
  117.   turtle.turnLeft()
  118.   turtle.turnLeft()
  119.   turtle.forward()
  120.   Fackel()
  121.   turtle.forward()
  122.   turtle.forward()
  123.   turtle.forward()
  124.   turtle.forward()
  125.   Vor()
  126.   Vor()
  127.   turtle.turnLeft()
  128.   turtle.turnLeft()
  129.   turtle.forward()
  130.   Fackel()
  131.   turtle.forward()
  132.   turtle.forward()
  133.   turtle.forward()
  134.   turtle.turnRight()
  135. end
  136.      
  137. function Durchlauf()
  138.   Vor()
  139.   Gang()
  140.   turtle.turnLeft()
  141.   turtle.turnLeft()
  142.     while GB ~= 0 do
  143.       turtle.forward()
  144.       GB = GB - 1
  145.     end
  146.   GB = D*2
  147.   Leeren()
  148.   turtle.turnLeft()
  149.   turtle.turnLeft()
  150.   WB()
  151.   GB = D*2      
  152. end
  153. while IG > G and GO == 1 do
  154.     D = D + 1
  155.     GB = GB + 2
  156.     Durchlauf()
  157.    
  158.     term.clear()
  159.     term.setCursorPos(1, 1)
  160.     write("Durchlauf nummer: ")
  161.     print(D)
  162.     write("Faktor: ")
  163.     print(GB)
  164.     sleep(1)
  165. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement