Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c8e029a70 | ||
|
|
c2bd4fd6ac | ||
|
|
222df46c47 | ||
|
|
21efddc1a0 | ||
|
|
b3650b7243 | ||
|
|
b070e22f33 | ||
|
|
e9cf875192 | ||
|
|
caa743fcc9 | ||
|
|
26f53761a7 | ||
|
|
d420664fde | ||
|
|
5dee428752 | ||
|
|
e2d689a618 | ||
|
|
c53a58c8e4 | ||
|
|
48f8998d7c | ||
|
|
17ccd3b61a | ||
|
|
1fc55d90f3 | ||
|
|
0a83d27962 | ||
|
|
06474e7f68 | ||
|
|
d7648a196c | ||
|
|
db3f71592c | ||
|
|
69b30552cb |
No files matched your search
+2
-1
@@ -2,4 +2,5 @@ __pycache__/
|
||||
*.pyc
|
||||
dist/
|
||||
build/
|
||||
*.egg-info/
|
||||
*.egg-info/
|
||||
test.py
|
||||
@@ -0,0 +1,51 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Working style
|
||||
|
||||
- During code review and code discussions, do NOT present ready-made code
|
||||
proposals or concrete snippets. Limit yourself to advice and recommendations
|
||||
(what is wrong, why, and the direction of the fix). Only write concrete code
|
||||
when the user explicitly asks for it.
|
||||
|
||||
## Project
|
||||
|
||||
`kostky` is a Czech-language terminal CLI game — a Farkle/"tisícovky" dice game variant for multiple players. Single runtime dependency: `tabulate` (for the final results table).
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
pip install -e ".[dev]" # editable install with mypy + ruff
|
||||
kostky # run the game (after install)
|
||||
python -m kostky # run without installing (requires tabulate)
|
||||
mypy # type-check (strict mode, see pyproject.toml)
|
||||
ruff check . # lint
|
||||
```
|
||||
|
||||
There are no tests in this repository.
|
||||
|
||||
## Architecture
|
||||
|
||||
The entire game lives in `kostky/kostky.py` as a single module with module-level mutable state (no classes):
|
||||
|
||||
- `hodnoty: dict[str, int]` — scoring table, loaded at import time from `kostky/hodnoty.csv` via `importlib.resources`. Keys are sorted-digit strings representing dice combos (e.g. `"111"` = three ones), values are point totals.
|
||||
- `players: dict[str, list[int]]` — per-player history of per-turn scores (insertion order == turn order).
|
||||
- `aggr: dict[str, int]` — per-player running total, used for win checks and the results table.
|
||||
- `pointer` / `first` — current player's name / the player who started the round (used to detect when a full round has completed in `next_player`/`check_win`).
|
||||
- `score` — points accumulated *within the current turn*, reset on bust or on banking (`k`).
|
||||
- `h_bool` — guards re-rolling: you can't roll again until you've banked at least one scoring combination in the current roll sequence.
|
||||
|
||||
Control flow is a manual state machine driven by tuples, not exceptions or return codes:
|
||||
|
||||
- `evaluate(inp, count, throw)` parses a single line of user input against the current dice state and returns a `data` tuple whose first element is a tag: `"count"` (continue turn with N remaining dice and a throw string), `"msg"` (show an error/message, possibly re-prompting), `"win"`, or `"exit"`.
|
||||
- `game(data)` is the main loop: it pattern-matches on `data[0]`, prints state, prompts for input, and calls `evaluate` again to get the next `data` tuple. This loop is how every turn — and the whole game — progresses.
|
||||
- Dice picks are entered as letters (`a`-`f` mapped to position 1-6 via `ord(x)-96`), not digit values; `evaluate` converts letters to positions internally before checking the picked dice values against `hodnoty`.
|
||||
- Bust detection (`check_value`) checks whether *any* key in `hodnoty` is a substring of the sorted current throw — not a full combinatorial scoring check, so this is the single source of truth for "is this throw dead."
|
||||
- Win condition (`check_win`) only fires once `pointer` cycles back to `first`, i.e. checked once per full round rather than once per turn, and only declares a winner if exactly one player is alone at/above `final_score`.
|
||||
|
||||
`kostky/__main__.py` and the `kostky` console-script entry point (in `pyproject.toml`) both call `kostky.kostky.main()`.
|
||||
|
||||
## Scoring data
|
||||
|
||||
`kostky/hodnoty.csv` (digit-string-of-dice-values → points) is the single source of truth for scoring and is also documented in tables in `README.md`. If you change one, update the other.
|
||||
@@ -1,25 +1,28 @@
|
||||
# kostky
|
||||
|
||||
Textová (CLI) hra v kostky pro více hráčů – varianta klasického *Farkle*
|
||||
(„tisícovky“). Běží celá v terminálu a je napsaná v čistém Pythonu bez
|
||||
externích závislostí.
|
||||
(„tisícovky“). Běží celá v terminálu, v Pythonu, s jedinou závislostí
|
||||
(`tabulate` pro závěrečnou výsledkovou tabulku).
|
||||
|
||||
## Požadavky
|
||||
|
||||
- Python 3.7+ (hra se spoléhá na zachování pořadí klíčů ve slovníku)
|
||||
- Žádné externí balíčky – používá se jen standardní knihovna
|
||||
(`random`, `os`, `re`, `csv`, `collections`, `typing`)
|
||||
- Python 3.9+
|
||||
- Závislost `tabulate` (doinstaluje se automaticky při instalaci)
|
||||
|
||||
## Spuštění
|
||||
## Instalace a spuštění
|
||||
|
||||
```bash
|
||||
git clone https://gitea.spacilovi.eu/david/kostky.git
|
||||
cd kostky
|
||||
python main.py
|
||||
pip install .
|
||||
kostky
|
||||
```
|
||||
|
||||
> Hru spouštěj z adresáře projektu – soubor `hodnoty.csv` (bodovací tabulka)
|
||||
> se načítá relativní cestou vůči aktuálnímu adresáři.
|
||||
Případně bez instalace (s nainstalovaným `tabulate`) přes `python -m kostky`,
|
||||
nebo izolovaně jako CLI nástroj přes `pipx install .`.
|
||||
|
||||
> Pro vývoj: `pip install -e ".[dev]"` – editovatelná instalace včetně `mypy`
|
||||
> a `ruff`.
|
||||
|
||||
## Jak se hraje
|
||||
|
||||
@@ -31,42 +34,45 @@ python main.py
|
||||
|
||||
### Průběh tahu
|
||||
|
||||
Na začátku tahu uvidíš cílové skóre, kdo je na tahu (a jeho celkové skóre)
|
||||
a hod šesti kostkami s očíslovanými pozicemi:
|
||||
Na začátku tahu uvidíš, kdo je na tahu (s jeho skóre a cílem), a hod šesti
|
||||
kostkami s písmennými pozicemi:
|
||||
|
||||
```
|
||||
Vítězné skóre: 10000.
|
||||
Na tahu je Anna (0).
|
||||
Na tahu je Anna (0/10000).
|
||||
1, 5, 3, 2, 6, 4
|
||||
^ ^ ^ ^ ^ ^
|
||||
1 2 3 4 5 6
|
||||
a b c d e f
|
||||
```
|
||||
|
||||
Pak zvolíš jednu z akcí:
|
||||
|
||||
| Vstup | Akce |
|
||||
| --- | --- |
|
||||
| `pozice kostek` | Odložíš vybrané kostky k vyhodnocení (např. `1`, `34`, `123456`). Hodnoty na zvolených pozicích musí dohromady tvořit některou kombinaci z bodovací tabulky. |
|
||||
| `pozice kostek` | Odložíš vybrané kostky k vyhodnocení – písmeny (např. `a`, `cd`, `abcdef`). Hodnoty na zvolených pozicích musí dohromady tvořit některou kombinaci z bodovací tabulky. |
|
||||
| `h` | Hodíš znovu zbývajícími kostkami. Povoleno až poté, co v tomto tahu odložíš aspoň jednu bodující kombinaci. |
|
||||
| `k` | Ukončíš tah, připíšeš si nasbírané skóre a předáš tah dalšímu hráči. |
|
||||
| `exit` | Předčasně ukončíš celou hru. |
|
||||
|
||||
Odkládat můžeš i víc kombinací po sobě – po každém vyhodnocení pokračuješ se
|
||||
zbývajícími kostkami a body se v rámci tahu sčítají.
|
||||
|
||||
### Smůla, hot dice a výhra
|
||||
### Smůla, hot dice, vynulování a výhra
|
||||
|
||||
- **Smůla (bust):** když čerstvý hod neobsahuje žádnou bodující kombinaci,
|
||||
o body z tohoto tahu přijdeš a tah přechází na dalšího hráče.
|
||||
- **Hot dice:** když se ti podaří odložit všech šest kostek, dostaneš čerstvý
|
||||
hod šesti kostkami a pokračuješ ve stejném tahu.
|
||||
- **Výhra:** po dokončení každého kola se kontroluje, jestli někdo dosáhl
|
||||
cílového skóre. Vyhrává osamocený lídr nad limitem; při shodě na první
|
||||
příčce se hraje dál.
|
||||
- **Vynulování:** tři po sobě jdoucí nulové tahy vynulují tvé celkové skóre.
|
||||
Počet aktuálních nul se vedle skóre ukazuje jako `x` / `xx`.
|
||||
- **Výhra:** po dokončení každého kola vyhrává osamocený lídr nad cílovým
|
||||
skóre; při shodě na první příčce se hraje dál. Na konci se vypíše výsledková
|
||||
tabulka s pořadím všech hráčů.
|
||||
|
||||
## Bodování
|
||||
|
||||
Kompletní tabulka je v souboru [`hodnoty.csv`](hodnoty.csv). Kombinace se
|
||||
vyhodnocuje podle hodnot odložených kostek – na jejich pořadí nezáleží.
|
||||
Kompletní tabulka je v souboru [`kostky/hodnoty.csv`](kostky/hodnoty.csv).
|
||||
Kombinace se vyhodnocuje podle hodnot odložených kostek – na jejich pořadí
|
||||
nezáleží.
|
||||
|
||||
### Stejné kostky
|
||||
|
||||
@@ -76,7 +82,7 @@ vyhodnocuje podle hodnot odložených kostek – na jejich pořadí nezáleží.
|
||||
| **2** | – | – | 200 | 400 | 800 | 1600 |
|
||||
| **3** | – | – | 300 | 600 | 1200 | 2400 |
|
||||
| **4** | – | – | 400 | 800 | 1600 | 3200 |
|
||||
| **5** | 50 | – | 500 | 1000 | 2000 | 4000 |
|
||||
| **5** | 50 | 100 | 500 | 1000 | 2000 | 4000 |
|
||||
| **6** | – | – | 600 | 1200 | 2400 | 4800 |
|
||||
|
||||
(„–“ = daná kombinace samostatně neboduje.)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
444,400
|
||||
2222,400
|
||||
333,300
|
||||
11,200
|
||||
222,200
|
||||
1,100
|
||||
5,50
|
||||
|
+170
-118
@@ -1,35 +1,35 @@
|
||||
from typing import Any
|
||||
from random import randint
|
||||
from os import system, name
|
||||
import re
|
||||
from importlib.resources import files
|
||||
import csv
|
||||
import re
|
||||
import subprocess
|
||||
from collections import Counter
|
||||
from importlib.resources import files
|
||||
from os import name
|
||||
from random import randint
|
||||
from typing import Any
|
||||
|
||||
from tabulate import tabulate
|
||||
|
||||
score: int = 0
|
||||
hodnoty: dict[str, int] = {}
|
||||
players: dict[str, list[int]] = {}
|
||||
pointer: str = ""
|
||||
first: str = ""
|
||||
h_bool: bool = True
|
||||
aggr: dict[str, int] = {}
|
||||
final_score: int = 10000
|
||||
|
||||
with open("hodnoty.csv", "r") as csv_file:
|
||||
csv_text = files(__package__).joinpath("hodnoty.csv").read_text(encoding="utf-8")
|
||||
csv_reader = csv.reader(csv_text.splitlines())
|
||||
csv_text = files(__package__).joinpath("hodnoty.csv").read_text(encoding="utf-8")
|
||||
csv_reader = csv.reader(csv_text.splitlines())
|
||||
|
||||
for row in csv_reader:
|
||||
key = str(row[0])
|
||||
value = int(row[1])
|
||||
for row in csv_reader:
|
||||
key = row[0]
|
||||
value = int(row[1])
|
||||
|
||||
hodnoty[key] = value
|
||||
hodnoty[key] = value
|
||||
|
||||
hodnoty = dict(sorted(hodnoty.items(), key=lambda x: x[1], reverse=True))
|
||||
|
||||
def throw(count: int) -> str:
|
||||
count = int(count)
|
||||
new_throw: list[str] = []
|
||||
for dice in range(count):
|
||||
for _dice in range(count):
|
||||
new_throw.append(str(randint(1, 6)))
|
||||
new_throw_str: str = "".join(new_throw)
|
||||
return new_throw_str
|
||||
@@ -41,30 +41,118 @@ def show_throw(throw: str) -> str:
|
||||
|
||||
pretty_list: str = ", ".join(throw_temp)
|
||||
pretty_list += "\n"
|
||||
for i in range(1, len(throw_temp) + 1):
|
||||
for _i in range(1, len(throw_temp) + 1):
|
||||
pretty_list += "^ "
|
||||
pretty_list += "\n"
|
||||
for i in range(1, len(throw_temp) + 1):
|
||||
pretty_list += f"{i} "
|
||||
for i in range(len(throw_temp)):
|
||||
pretty_list += f"{chr(97+i)} "
|
||||
return pretty_list
|
||||
|
||||
def clear() -> None:
|
||||
if name == 'nt':
|
||||
_ = system('cls')
|
||||
else:
|
||||
_ = system('clear')
|
||||
_ = subprocess.call('cls', shell=True) if name == 'nt' else subprocess.call('clear', shell=True)
|
||||
|
||||
def evaluate(inp: Any, count: int, throw: str) -> tuple[Any, ...]:
|
||||
|
||||
global h_bool
|
||||
|
||||
def eval_score(pick: str) -> bool:
|
||||
if(pick in hodnoty):
|
||||
global score
|
||||
score += hodnoty[pick]
|
||||
return True
|
||||
def translate_letters_to_numbers(inp_hod: str, count: int) -> tuple[bool, str]:
|
||||
inp_temp: str = ""
|
||||
for x in inp_hod:
|
||||
x_int: int = ord(x)-96
|
||||
if x_int > count:
|
||||
ran = "1" if count == 1 else f"1–{count}"
|
||||
return False, f"Zvolte prosím kostky v platném rozsahu ({ran}): "
|
||||
else:
|
||||
return False
|
||||
inp_temp += str(x_int)
|
||||
|
||||
return True, inp_temp
|
||||
|
||||
def pick_throw_proc(count: int, inp_hod: str, throw: str) -> tuple[str, str]:
|
||||
old_throw: list[str] = []
|
||||
pick: list[str] = []
|
||||
for y in range(count):
|
||||
if str(y+1) not in inp_hod:
|
||||
old_throw.append(throw[y])
|
||||
if str(y+1) in inp_hod:
|
||||
pick.append(throw[y])
|
||||
|
||||
old_throw_str: str = "".join(old_throw)
|
||||
pick.sort()
|
||||
pick_str: str = "".join(pick)
|
||||
|
||||
return old_throw_str, pick_str
|
||||
|
||||
def eval_score(pick: str) -> int:
|
||||
score = 0
|
||||
pick_counter = Counter(pick)
|
||||
while pick_counter:
|
||||
bool_temp = False
|
||||
for k in hodnoty:
|
||||
k_counter = Counter(k)
|
||||
if k_counter <= pick_counter:
|
||||
pick_counter = pick_counter - k_counter
|
||||
score += hodnoty[k]
|
||||
bool_temp = True
|
||||
|
||||
if not bool_temp:
|
||||
break
|
||||
|
||||
if pick_counter:
|
||||
score = 0
|
||||
|
||||
return score
|
||||
|
||||
def eval_wrapper(count: int, throw: str, inp_hod: str) -> tuple[bool, int, int, str]:
|
||||
if not inp_hod:
|
||||
data = (
|
||||
True,
|
||||
0,
|
||||
count,
|
||||
"",
|
||||
)
|
||||
elif re.search(r"^[a-f]+$", inp_hod):
|
||||
if len(inp_hod) > count:
|
||||
data = (
|
||||
False,
|
||||
0,
|
||||
count,
|
||||
"Tolika kostkami nemůžete hodit. Zkuste to znovu: ",
|
||||
)
|
||||
else:
|
||||
tltn = translate_letters_to_numbers(inp_hod, count)
|
||||
if tltn[0]:
|
||||
inp_hod = tltn[1]
|
||||
|
||||
old_throw_str, pick_str = pick_throw_proc(count, inp_hod, throw)
|
||||
|
||||
new_count: int = len(old_throw_str)
|
||||
|
||||
score = eval_score(pick_str)
|
||||
|
||||
if not score:
|
||||
new_count = count
|
||||
old_throw_str = throw
|
||||
|
||||
data = (
|
||||
True,
|
||||
score,
|
||||
new_count,
|
||||
"",
|
||||
)
|
||||
else:
|
||||
data = (
|
||||
False,
|
||||
0,
|
||||
count,
|
||||
tltn[1]
|
||||
)
|
||||
else:
|
||||
data = (
|
||||
False,
|
||||
0,
|
||||
count,
|
||||
"Zadejte prosím platnou hodnotu: ",
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
def evaluate(inp_akce: str, count: int, score: int) -> tuple[Any, ...]:
|
||||
|
||||
def next_player() -> None:
|
||||
global pointer
|
||||
@@ -77,54 +165,10 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple[Any, ...]:
|
||||
|
||||
pointer = nxt_key
|
||||
|
||||
inp = str(inp)
|
||||
if re.search(r"^\d+$", inp):
|
||||
if len(inp) > count:
|
||||
data: tuple[Any, ...] = ("msg", "ER01", "Tolika kostkami nemůžete hodit. Zkuste to znovu: ", count, throw)
|
||||
else:
|
||||
for x in inp:
|
||||
x = int(x)
|
||||
if x > count:
|
||||
if count == 1:
|
||||
ran = "1"
|
||||
else:
|
||||
ran = f"1–{count}"
|
||||
data = ("msg", "ER02", f"Zvolte prosím kostky v platném rozsahu ({ran}): ", count, throw)
|
||||
return data
|
||||
old_throw: list[str] = []
|
||||
pick: list[str] = []
|
||||
for y in range(count):
|
||||
if str(y+1) not in inp:
|
||||
old_throw.append(throw[y])
|
||||
if str(y+1) in inp:
|
||||
pick.append(throw[y])
|
||||
|
||||
old_throw_str: str = "".join(old_throw)
|
||||
pick.sort()
|
||||
pick_str: str = "".join(pick)
|
||||
|
||||
new_count: int = len(old_throw_str)
|
||||
|
||||
if not eval_score(pick_str):
|
||||
new_count = count
|
||||
old_throw_str = throw
|
||||
else:
|
||||
h_bool = False
|
||||
|
||||
data = ("count", new_count, old_throw_str)
|
||||
|
||||
elif inp == "h":
|
||||
if h_bool:
|
||||
clear()
|
||||
input("Nemůžete házet znovu, dokud nevyhodnotíte některé kostky.")
|
||||
data = ("count", count, throw)
|
||||
else:
|
||||
h_bool = True
|
||||
data = ("count", count, "")
|
||||
|
||||
elif inp == "k":
|
||||
global score
|
||||
if inp_akce == "h":
|
||||
data = ("count", count, score)
|
||||
|
||||
elif inp_akce == "k" or not inp_akce:
|
||||
if score == 0:
|
||||
last_two = players[pointer][-2:]
|
||||
if len(last_two) > 1:
|
||||
@@ -136,21 +180,16 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple[Any, ...]:
|
||||
|
||||
players[pointer].append(score)
|
||||
aggr[pointer] = sum(players[pointer])
|
||||
score = 0
|
||||
h_bool = True
|
||||
next_player()
|
||||
data = ("count", 6, "")
|
||||
data = ("count", 6, 0)
|
||||
if pointer == first:
|
||||
winner: str = check_win()
|
||||
if winner:
|
||||
data = ("win", winner, aggr[winner])
|
||||
|
||||
elif inp == "exit":
|
||||
elif inp_akce == "x":
|
||||
data = ("exit",)
|
||||
|
||||
else:
|
||||
data = ("msg", "ER03", "Zadejte prosím platnou hodnotu:", count, throw)
|
||||
|
||||
return data
|
||||
|
||||
def check_value(throw: str) -> bool:
|
||||
@@ -205,8 +244,9 @@ def add_players() -> None:
|
||||
else:
|
||||
break
|
||||
|
||||
def to_sorted_tuple(d: dict[str, int], s: bool = True) -> tuple[list[tuple[int, str, int]], dict[str, int]]:
|
||||
L: list[tuple[str, int]] = []
|
||||
def to_sorted_tuple(d: dict[str, int], s: bool = True) -> tuple[list[tuple[int, str, int]],
|
||||
dict[str, int]]:
|
||||
L: list[tuple[int, str, int]] = []
|
||||
|
||||
if s:
|
||||
d = dict(sorted(d.items(), key=lambda x: x[1], reverse=True))
|
||||
@@ -251,53 +291,65 @@ def game(data: tuple) -> None:
|
||||
while True:
|
||||
if data[0] == "count":
|
||||
count: int = data[1]
|
||||
th: str = data[2]
|
||||
if(th == ""):
|
||||
th = throw(count)
|
||||
score: int = data[2]
|
||||
if not count:
|
||||
count = 6
|
||||
th = throw(count)
|
||||
clear()
|
||||
# print(f"Vítězné skóre: {final_score}.")
|
||||
|
||||
strikes: str = ""
|
||||
|
||||
if len(players[pointer]) > 0:
|
||||
if players[pointer][-1:][0] == 0:
|
||||
strikes = "x"
|
||||
if players[pointer][-2:][0] == 0:
|
||||
if players[pointer][-2:][0] == 0 and len(players[pointer]) > 1:
|
||||
strikes += "x"
|
||||
else:
|
||||
strikes = ""
|
||||
|
||||
print(f"Na tahu je {pointer} ({aggr[pointer]}{strikes}/{final_score}).")
|
||||
print(show_throw(th))
|
||||
if not check_value(th) and data[2] == "" and count != 0:
|
||||
global score
|
||||
if not check_value(th) and count != 0:
|
||||
score = 0
|
||||
input("Oh no... anyway.")
|
||||
data = evaluate("k", count, th)
|
||||
data = evaluate("k", count, score)
|
||||
else:
|
||||
if count == 0:
|
||||
count = 6
|
||||
msg: str = ("Jakou akci chcete provést?\n"
|
||||
" - Zadejte kombinaci kostek k ponechání (dojde k jejich vyhodnocení): [pozice kostek] (např. 1 nebo 34 nebo 123456).\n"
|
||||
" - Hodit znovu: [h].\n"
|
||||
f" - Ukončit hod a ponechat si skóre z tohoto hodu ({score}): [k].\n"
|
||||
" - Ukončit hru: [exit].\n"
|
||||
)
|
||||
inp: str = input(msg)
|
||||
data = evaluate(inp, count, th)
|
||||
inp_hod: str = input("Vyberte kostky k vyhodnocení: ")
|
||||
while True:
|
||||
data = eval_wrapper(count, th, inp_hod)
|
||||
if not data[0]:
|
||||
inp_hod = input(data[3])
|
||||
continue
|
||||
score_temp = data[1]
|
||||
print("Hodnota hodu:", score_temp)
|
||||
add = ("Hodnota je nulová. Ukončit kolo a přičíst "
|
||||
f"{score} bodů? ") if not score_temp else ""
|
||||
while True:
|
||||
inp = input(f"Potvrdit výběr? {add}[a]no/[n]e: ")
|
||||
if inp in ["a", "y", "n"]:
|
||||
break
|
||||
if inp in ["a", "y"]:
|
||||
count = data[2]
|
||||
score += score_temp
|
||||
break
|
||||
inp_hod = input("Vyberte kostky k vyhodnocení: ")
|
||||
|
||||
while True:
|
||||
if not score_temp:
|
||||
inp_akce: str = "k"
|
||||
else:
|
||||
inp_akce = input(
|
||||
f"[h]odit znovu\nu[k]ončit tah a přičíst {score} bodů\ne[x]it?\n"
|
||||
)
|
||||
if inp_akce in ["h", "k", "x"]:
|
||||
break
|
||||
else:
|
||||
print("Zadejte prosím platnou hodnotu [h/k/x]. ")
|
||||
|
||||
data = evaluate(inp_akce, count, score)
|
||||
|
||||
elif data[0] == "msg":
|
||||
if data[1] == "ER01" or data[1] == "ER02" or data[1] == "ER03":
|
||||
msg = data[2]
|
||||
count = data[3]
|
||||
th = data[4]
|
||||
inp = input(msg)
|
||||
data = evaluate(inp, count, th)
|
||||
else:
|
||||
msg = data[1]
|
||||
print(msg)
|
||||
break
|
||||
|
||||
elif data[0] == "win":
|
||||
winner: str = data[1]
|
||||
score = data[2]
|
||||
@@ -315,7 +367,7 @@ def main() -> None:
|
||||
clear()
|
||||
print("Vítejte ve hře v kostky!")
|
||||
add_players()
|
||||
data = ("count", 6, "")
|
||||
data = ("count", 6, 0)
|
||||
game(data)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ source = "vcs"
|
||||
packages = ["kostky"]
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.9"
|
||||
python_version = "3.10"
|
||||
strict = true
|
||||
files = ["kostky"]
|
||||
|
||||
|
||||
Reference in new issue
Block a user