def evaluate(inp: Any, count: int, throw: str) -> tuple:
global h_bool
def eval_score(pick: str) -> bool:
if(pick in hodnoty):
global score
score += hodnoty[pick]
return True
else:
return False
def next_player() -> None:
global pointer
keys_iter = iter(players)
for key in keys_iter:
if key == pointer:
nxt_key = next(keys_iter, first)
break
pointer = nxt_key
inp = str(inp)
if re.search(r"^\d+$", inp):
if len(inp) > count:
data = ("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 # return speciálně pro tento případ
old_throw = []
pick = []
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 = "".join(old_throw)
pick.sort()
pick = "".join(pick)
new_count = len(old_throw)
if not eval_score(pick):
new_count = count
old_throw = throw
else:
h_bool = False
data = ("count", new_count, old_throw)
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
players[pointer].append(score)
aggr[pointer] = sum(players[pointer])
score = 0
h_bool = True
next_player()
data = ("count", 6, "")
if pointer == first:
winner = check_win()
if winner:
data = ("win", winner, aggr[winner])
elif inp == "exit":
data = ("exit",)
else:
data = ("msg", "ER03", "Zadejte prosím platnou hodnotu:", count, throw)
return data # výsledný return
returny tam, kde jsou třeba:
```
def evaluate(inp: Any, count: int, throw: str) -> tuple:
global h_bool
def eval_score(pick: str) -> bool:
if(pick in hodnoty):
global score
score += hodnoty[pick]
return True
else:
return False
def next_player() -> None:
global pointer
keys_iter = iter(players)
for key in keys_iter:
if key == pointer:
nxt_key = next(keys_iter, first)
break
pointer = nxt_key
inp = str(inp)
if re.search(r"^\d+$", inp):
if len(inp) > count:
data = ("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 # return speciálně pro tento případ
old_throw = []
pick = []
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 = "".join(old_throw)
pick.sort()
pick = "".join(pick)
new_count = len(old_throw)
if not eval_score(pick):
new_count = count
old_throw = throw
else:
h_bool = False
data = ("count", new_count, old_throw)
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
players[pointer].append(score)
aggr[pointer] = sum(players[pointer])
score = 0
h_bool = True
next_player()
data = ("count", 6, "")
if pointer == first:
winner = check_win()
if winner:
data = ("win", winner, aggr[winner])
elif inp == "exit":
data = ("exit",)
else:
data = ("msg", "ER03", "Zadejte prosím platnou hodnotu:", count, throw)
return data # výsledný return
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
returny tam, kde jsou třeba: