feature: výběr kostek: odečítání vybraných kostek z nového hodu

This commit is contained in:
david-spacil committed 2026-06-18 20:51:07 +02:00
1 parent 0c6f99f841
commit 16d940253d
1 file changed
+14 -5
+14 -5
View File
@@ -1,5 +1,6 @@
from random import randint from random import randint
from os import system, name from os import system, name
import re
def throw(count): def throw(count):
count = int(count) count = int(count)
@@ -24,17 +25,25 @@ def clear():
else: else:
_ = system('clear') _ = system('clear')
def game(): def evaluate(inp, count):
new_throw = throw(6) inp = str(inp)
if re.search("^\d+$", inp):
count = len(inp)
return count
def game(count):
new_throw = throw(count)
clear() clear()
print(show_throw(new_throw)) print(show_throw(new_throw))
input("Prosím, stiskněte enter pro další hod:") inp = input("Vyberte, kterými kostkami chcete hodit znovu (např. 135):")
game() count = evaluate(inp, count)
game(count)
def main(): def main():
print("Vítejte ve hře v kostky!") print("Vítejte ve hře v kostky!")
input("Prosím, stiskněte enter pro první hod:") input("Prosím, stiskněte enter pro první hod:")
game() count = 6
game(count)
if __name__ == "__main__": if __name__ == "__main__":
main() main()