From 16d940253d419bae151179d25b638ed020fe8746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sp=C3=A1=C4=8Dil?= Date: Thu, 18 Jun 2026 20:51:07 +0200 Subject: [PATCH] =?UTF-8?q?feature:=20v=C3=BDb=C4=9Br=20kostek:=20ode?= =?UTF-8?q?=C4=8D=C3=ADt=C3=A1n=C3=AD=20vybran=C3=BDch=20kostek=20z=20nov?= =?UTF-8?q?=C3=A9ho=20hodu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index b24ba74..106525d 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,6 @@ from random import randint from os import system, name +import re def throw(count): count = int(count) @@ -24,17 +25,25 @@ def clear(): else: _ = system('clear') -def game(): - new_throw = throw(6) +def evaluate(inp, count): + inp = str(inp) + if re.search("^\d+$", inp): + count = len(inp) + return count + +def game(count): + new_throw = throw(count) clear() print(show_throw(new_throw)) - input("Prosím, stiskněte enter pro další hod:") - game() + inp = input("Vyberte, kterými kostkami chcete hodit znovu (např. 135):") + count = evaluate(inp, count) + game(count) def main(): print("Vítejte ve hře v kostky!") input("Prosím, stiskněte enter pro první hod:") - game() + count = 6 + game(count) if __name__ == "__main__": main()