Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.black)
- term.clear()
- term.setBackgroundColor(colors.white)
- term.setCursorPos(1, 1)
- print("1 2 3")
- print("4 5 6")
- print("7 8 9")
- print("ENTER")
- term.setCursorPos(1, 6)
- write("Anzahl an Gaengen: ")
- IG = 0
- GO = 0
- event, side, x, y = os.pullEvent("mouse_click")
- if x == 1 and y == 1 then
- IG = IG + "1"
- end
- if x == 3 and y == 1 then
- IG = IG + "2"
- end
- if x == 5 and y == 1 then
- IG = IG + "3"
- end
- if x == 1 and y == 2 then
- IG = IG +"4"
- end
- if x == 3 and y == 2 then
- IG = IG + "5"
- end
- if x == 5 and y == 2 then
- IG = IG + "6"
- end
- if x == 1 and y == 3 then
- IG = IG + "7"
- end
- if x == 3 and y == 3 then
- IG = IG + "8"
- end
- if x == 5 and y == 3 then
- IG = IG + "9"
- end
- print(IG)
- event, side, x, y = os.pullEvent("mouse_click")
- if x > 1 and x < 5 and y == 1 then
- GO = 1
- end
- G = 1
- GB = 0
- D = 0
- function Vor()
- while turtle.detect() do
- turtle.dig()
- sleep(0.3)
- end
- if not turtle.detectDown() then
- select(1)
- turtle.placeDown()
- end
- turtle.forward()
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.3)
- end
- while turtle.detect() do
- turtle.dig()
- sleep(0.3)
- end
- if not turtle.detectDown() then
- select(1)
- turtle.placeDown()
- end
- turtle.forward()
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.3)
- end
- end
- function Fackel()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(2)
- turtle.place()
- turtle.select(1)
- turtle.turnRight()
- turtle.turnRight()
- end
- function Leeren()
- local i = 3
- for i = 3,16 do
- turtle.select(i)
- turtle.drop(64)
- end
- turtle.select(1)
- end
- function WB()
- while GB ~= 0 do
- turtle.forward()
- GB = GB - 1
- end
- end
- function Gang()
- turtle.turnLeft()
- Vor()
- Vor()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- Fackel()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- Vor()
- Vor()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- Fackel()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- end
- function Durchlauf()
- Vor()
- Gang()
- turtle.turnLeft()
- turtle.turnLeft()
- while GB ~= 0 do
- turtle.forward()
- GB = GB - 1
- end
- GB = D*2
- Leeren()
- turtle.turnLeft()
- turtle.turnLeft()
- WB()
- GB = D*2
- end
- while IG > G and GO == 1 do
- D = D + 1
- GB = GB + 2
- Durchlauf()
- term.clear()
- term.setCursorPos(1, 1)
- write("Durchlauf nummer: ")
- print(D)
- write("Faktor: ")
- print(GB)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement