Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- promenne --
- do
- zetony = 0
- vyseSazky = 0
- rng1 = 0
- rng2 = 0
- rng3 = 0
- vyhra = 0
- kolikDobit = 0
- term.clear()
- end
- -- vysvetleni principu hry --
- do
- term.clear()
- x, y = term.getSize()
- term.setCursorPos(x/2-4, 2)
- print("AUTOMATY")
- textutils.slowPrint("---------------------------------------------------")
- print("Pokud vam padne 3x stejne cislo, vyhravate dvojnasobek vaseho vkladu")
- print("1 diamant = 1 zeton")
- print("Diamanty hazejte po vyzvani do vody vedle automatu")
- print("Pro pokracovani stisknete ENTER")
- io.read()
- term.clear()
- end
- -- hlavni program --
- while true do
- term.clear()
- x, y = term.getSize()
- term.setCursorPos(x/2-4, 2)
- print("AUTOMATY")
- textutils.slowPrint("---------------------------------------------------")
- print("Zvolte moznost:")
- print("1. Dobit zetony")
- print("2. Hrat automaty")
- print("3. Vybrat vyhru")
- print("4. Odejit")
- print("Vas pocet zetonu je: "..zetony)
- volba = read()
- volba = tonumber(volba)
- if volba == 1 then
- term.clear()
- print("Zadej, kolik zetonu chces dobit:")
- kolikDobit = read()
- kolikDobit = tonumber(kolikDobit)
- p = kolikDobit
- while p > 0 do
- os.pullEvent()
- if redstone.getInput("left") == true then
- zetony = zetony + 1
- print("Vas pocet zetonu je: "..zetony)
- p = p - 1
- sleep(1)
- end
- end
- elseif volba == 2 then
- term.clear()
- rng1 = math.random(1,3)
- rng2 = math.random(1,3)
- rng3 = math.random(1,3)
- x, y = term.getSize()
- term.setCursorPos(x/2-4, 2)
- print("AUTOMATY")
- textutils.slowPrint("---------------------------------------------------")
- print("Vas pocet zetonu je: "..zetony)
- print("Zadejte o kolik zetonu chcete hrat")
- vyseSazky = read()
- vyseSazky = tonumber(vyseSazky)
- if vyseSazky > zetony then
- print("Nemate dostatek zetonu, dobijte si prosim")
- sleep(1)
- else
- if a == b then
- if a == c then
- if b == c then
- print("Vyhral jste!!!")
- zetony = vyseSazky * 2
- end
- else
- print("Prohral jste!")
- zetony = zetony - vyseSazky
- end
- else
- print("Prohral jste!")
- zetony = zetony - vyseSazky
- end
- end
- elseif volba == 3 then
- term.clear()
- if zetony > 0 then
- print("Je vam vyplacena vyhra")
- i = zetony
- while i > 0 do
- sleep(1)
- redstone.setOutput("back", true)
- sleep(1)
- redstone.setOutput("back, false")
- i = i - 1
- end
- term.clear()
- print("Vyhra byla vyplacena")
- else
- print("Nemate zadne zetony na vyplaceni")
- end
- else
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement