enhancement/pismena: převod z čísel na písmena a zpět

This commit is contained in:
David Spáčil
2026-06-27 19:06:12 +02:00
committed by david
parent d7648a196c
commit 06474e7f68
+10 -4
View File
@@ -44,8 +44,8 @@ def show_throw(throw: str) -> str:
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:
@@ -75,7 +75,9 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple[Any, ...]:
pointer = nxt_key
inp = str(inp)
if re.search(r"^\d+$", inp):
inp_temp: str = ""
if re.search(r"^[a-f]+$", inp):
if len(inp) > count:
data: tuple[Any, ...] = (
"msg",
@@ -86,7 +88,7 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple[Any, ...]:
)
else:
for x in inp:
x = int(x)
x = ord(x)-96
if x > count:
ran = "1" if count == 1 else f"1{count}"
data = (
@@ -97,6 +99,10 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple[Any, ...]:
throw
)
return data
else:
inp_temp += str(x)
inp = inp_temp
old_throw: list[str] = []
pick: list[str] = []
for y in range(count):