release: v0.2.0 #28

Merged
david-spacil merged 35 commits from version/v0.2.0 into main 2026-06-27 19:42:23 +02:00
Showing only changes of commit c3a2e94cab - Show all commits
+14 -7
View File
@@ -202,6 +202,17 @@ def add_players() -> None:
else: else:
break break
def to_sorted_tuple(d: dict[str, int], s: bool = True) -> tuple[list[tuple[str, int]], dict[str, int]]:
L: list[tuple[str, int]] = []
if s:
d = dict(sorted(d.items(), key=lambda x: x[1], reverse=True))
for k in d:
L.append((k, d[k]))
return L, d
def check_win() -> str: def check_win() -> str:
over_limit: dict[str, int] = {} over_limit: dict[str, int] = {}
for p in aggr: for p in aggr:
@@ -211,17 +222,13 @@ def check_win() -> str:
winner: str = "" winner: str = ""
if over_limit: if over_limit:
over_limit_sorted: dict[str, int] = dict(sorted(over_limit.items(), key=lambda x: x[1], reverse=True)) L, d = to_sorted_tuple(over_limit)
over_limit_sorted_list: list[tuple[str, int]] = []
for ols in over_limit_sorted:
over_limit_sorted_list.append((ols, over_limit_sorted[ols]))
count: Counter = Counter(list(d.values()))
count: Counter = Counter(list(over_limit_sorted.values()))
for c in count: for c in count:
if count[c] == 1: if count[c] == 1:
winner = over_limit_sorted_list[0][0] winner = L[0][0]
break break
return winner return winner