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()