From cf21f7fbdde411f5abb6164b4492c097bbe6a4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sp=C3=A1=C4=8Dil?= Date: Tue, 23 Jun 2026 22:04:44 +0200 Subject: [PATCH] =?UTF-8?q?feature/hraci:=20z=C3=A1kaz=20nov=C3=A9ho=20hod?= =?UTF-8?q?u=20v=C3=ADce=20ne=C5=BE=20jednou=20v=20=C5=99ad=C4=9B=20(v?= =?UTF-8?q?=C4=8Detn=C4=9B=20hodu=20n=C3=A1sleduj=C3=ADc=C3=ADho=20po=20pr?= =?UTF-8?q?vn=C3=ADm=20hodu=20tahu)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 1306607..a77dfe7 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,7 @@ hodnoty = {} players = {} pointer = "" first = "" +h_bool = True with open("hodnoty.csv", "r") as csv_file: csv_reader = csv.reader(csv_file) @@ -48,6 +49,9 @@ def clear(): _ = system('clear') def evaluate(inp: Any, count: int, throw: str) -> tuple: + + global h_bool + def eval_score(pick: str) -> bool: if(pick in hodnoty): global score @@ -99,16 +103,25 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple: if eval_score(pick) == False: new_count = count old_throw = throw + else: + h_bool = False data = ("count", new_count, old_throw) return data elif inp == "h": - data = ("count", count, "") + if h_bool: + clear() + input("Nemůžete házet znovu, dokud nevyhodnotíte některé kostky.") + data = ("count", count, throw) + else: + h_bool = True + data = ("count", count, "") return data elif inp == "k": global score players[pointer].append(score) score = 0 + h_bool = True next_player() data = ("count", 6, "") return data @@ -175,6 +188,7 @@ def game(data: tuple): " - Hodit znovu: [h].\n" f" - Ukončit hod a ponechat si skóre z tohoto hodu ({score}): [k].\n" ) + print(players) # if old_throw != "": # msg += f"\nHodnoty odložených kostek: {old_throw}" inp = input(msg)