feature/vysledky: definice funkce win() a její volání z bloku win ve funkci game()

This commit is contained in:
David Spáčil
2026-06-27 17:15:47 +02:00
parent bdd66379f7
commit 7b0c9cadbb
+13 -2
View File
@@ -4,6 +4,7 @@ from os import system, name
import re
import csv
from collections import Counter
from tabulate import tabulate
score: int = 0
hodnoty: dict[str, int] = {}
@@ -233,6 +234,17 @@ def check_win() -> str:
return winner
def win(winner: str, score: int) -> None:
results, d = to_sorted_tuple(aggr)
headers = ["Pořadí", "Hráč", "Skóre"]
table = tabulate(results, headers=headers, tablefmt="fancy_grid")
print(f"Vítězem se stává {winner} s {score} body!")
print("Díky za hru a zase příště.\n")
print(table)
def game(data: tuple) -> None:
while True:
if data[0] == "count":
@@ -289,8 +301,7 @@ def game(data: tuple) -> None:
score = data[2]
clear()
print(f"Vítězem se stává {winner} s {score} body!")
print("Díky za hru a zase příště.")
win(winner, score)
break
elif data[0] == "exit":