Merge pull request 'enhancement: výběr kostek písmeny místo čísel' (#27) from enhancement/pismena-misto-cisel into version/v0.2.0
Reviewed-on: david/kostky#27
This commit was merged in pull request #27.
This commit is contained in:
+10
-4
@@ -44,8 +44,8 @@ def show_throw(throw: str) -> str:
|
|||||||
for _i in range(1, len(throw_temp) + 1):
|
for _i in range(1, len(throw_temp) + 1):
|
||||||
pretty_list += "^ "
|
pretty_list += "^ "
|
||||||
pretty_list += "\n"
|
pretty_list += "\n"
|
||||||
for i in range(1, len(throw_temp) + 1):
|
for i in range(len(throw_temp)):
|
||||||
pretty_list += f"{i} "
|
pretty_list += f"{chr(97+i)} "
|
||||||
return pretty_list
|
return pretty_list
|
||||||
|
|
||||||
def clear() -> None:
|
def clear() -> None:
|
||||||
@@ -75,7 +75,9 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple[Any, ...]:
|
|||||||
pointer = nxt_key
|
pointer = nxt_key
|
||||||
|
|
||||||
inp = str(inp)
|
inp = str(inp)
|
||||||
if re.search(r"^\d+$", inp):
|
inp_temp: str = ""
|
||||||
|
|
||||||
|
if re.search(r"^[a-f]+$", inp):
|
||||||
if len(inp) > count:
|
if len(inp) > count:
|
||||||
data: tuple[Any, ...] = (
|
data: tuple[Any, ...] = (
|
||||||
"msg",
|
"msg",
|
||||||
@@ -86,7 +88,7 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple[Any, ...]:
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
for x in inp:
|
for x in inp:
|
||||||
x = int(x)
|
x = ord(x)-96
|
||||||
if x > count:
|
if x > count:
|
||||||
ran = "1" if count == 1 else f"1–{count}"
|
ran = "1" if count == 1 else f"1–{count}"
|
||||||
data = (
|
data = (
|
||||||
@@ -97,6 +99,10 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple[Any, ...]:
|
|||||||
throw
|
throw
|
||||||
)
|
)
|
||||||
return data
|
return data
|
||||||
|
else:
|
||||||
|
inp_temp += str(x)
|
||||||
|
inp = inp_temp
|
||||||
|
|
||||||
old_throw: list[str] = []
|
old_throw: list[str] = []
|
||||||
pick: list[str] = []
|
pick: list[str] = []
|
||||||
for y in range(count):
|
for y in range(count):
|
||||||
|
|||||||
Reference in New Issue
Block a user