From d854190480411d6b35720e81fa59dbb68ad71346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sp=C3=A1=C4=8Dil?= Date: Sun, 21 Jun 2026 15:52:03 +0200 Subject: [PATCH] =?UTF-8?q?feature/hod:=20=C3=BAvodn=C3=AD=20kontrola=20ko?= =?UTF-8?q?mbinace=20v=20hodu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 709f2b3..b4f6b60 100644 --- a/main.py +++ b/main.py @@ -62,6 +62,17 @@ def evaluate(inp, count, throw): data = ("count", count, old_throw) return data +def check_value(throw): + throw.sort() + throw_str = "".join(throw) + hodnota = False + for h in hodnoty: + if h in throw_str: + hodnota = True + break + + return hodnota + def game(data: tuple): if data[0] == "count": count = data[1] @@ -69,12 +80,15 @@ def game(data: tuple): new_throw = throw(count) clear() print(show_throw(new_throw)) - msg = "Vyberte, kterými kostkami chcete hodit znovu (např. 135):" - if old_throw != "": - msg += f"\nHodnoty odložených kostek: {old_throw}" - inp = input(msg) - data = evaluate(inp, count, new_throw) - game(data) + if check_value(new_throw): + msg = "Vyberte, kterými kostkami chcete hodit znovu (např. 135):" + if old_throw != "": + msg += f"\nHodnoty odložených kostek: {old_throw}" + inp = input(msg) + data = evaluate(inp, count, new_throw) + game(data) + else: + print("Smůla, třeba příště.") elif data[0] == "msg": if data[1] == "ER01" or data[1] == "ER02": msg = data[2]