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]