fix/loop: změna z rekurzivní funkce na while loop v game()

This commit is contained in:
david-spacil committed 2026-06-25 13:15:18 +02:00
1 parent 16578d3a19
commit 4da38654aa
1 file changed
+3 -3
+3 -3
View File
@@ -209,6 +209,7 @@ def check_win() -> str:
return winner
def game(data: tuple):
while True:
if data[0] == "count":
count = data[1]
th = data[2]
@@ -223,7 +224,6 @@ def game(data: tuple):
score = 0
input("Oh no... anyway.")
data = evaluate("k", count, th)
game(data)
else:
if count == 0:
count = 6
@@ -234,7 +234,6 @@ def game(data: tuple):
)
inp = input(msg)
data = evaluate(inp, count, th)
game(data)
elif data[0] == "msg":
if data[1] == "ER01" or data[1] == "ER02" or data[1] == "ER03":
@@ -244,10 +243,10 @@ def game(data: tuple):
clear()
inp = input(msg)
data = evaluate(inp, count, th)
game(data)
else:
msg = data[1]
print(msg)
break
elif data[0] == "win":
winner = data[1]
@@ -256,6 +255,7 @@ def game(data: tuple):
clear()
print(f"Vítězem se stává {winner} s {score} body!")
print("Díky za hru a zase příště.")
break
def main():
clear()