feature/hod: úvodní kontrola kombinace v hodu
This commit is contained in:
@@ -62,6 +62,17 @@ def evaluate(inp, count, throw):
|
|||||||
data = ("count", count, old_throw)
|
data = ("count", count, old_throw)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def check_value(throw):
|
||||||
|
throw.sort()
|
||||||
|
throw_str = "".join(throw)
|
||||||
|
hodnota = False
|
||||||
|
for h in hodnoty:
|
||||||
|
if h in throw_str:
|
||||||
|
hodnota = True
|
||||||
|
break
|
||||||
|
|
||||||
|
return hodnota
|
||||||
|
|
||||||
def game(data: tuple):
|
def game(data: tuple):
|
||||||
if data[0] == "count":
|
if data[0] == "count":
|
||||||
count = data[1]
|
count = data[1]
|
||||||
@@ -69,12 +80,15 @@ def game(data: tuple):
|
|||||||
new_throw = throw(count)
|
new_throw = throw(count)
|
||||||
clear()
|
clear()
|
||||||
print(show_throw(new_throw))
|
print(show_throw(new_throw))
|
||||||
msg = "Vyberte, kterými kostkami chcete hodit znovu (např. 135):"
|
if check_value(new_throw):
|
||||||
if old_throw != "":
|
msg = "Vyberte, kterými kostkami chcete hodit znovu (např. 135):"
|
||||||
msg += f"\nHodnoty odložených kostek: {old_throw}"
|
if old_throw != "":
|
||||||
inp = input(msg)
|
msg += f"\nHodnoty odložených kostek: {old_throw}"
|
||||||
data = evaluate(inp, count, new_throw)
|
inp = input(msg)
|
||||||
game(data)
|
data = evaluate(inp, count, new_throw)
|
||||||
|
game(data)
|
||||||
|
else:
|
||||||
|
print("Smůla, třeba příště.")
|
||||||
elif data[0] == "msg":
|
elif data[0] == "msg":
|
||||||
if data[1] == "ER01" or data[1] == "ER02":
|
if data[1] == "ER01" or data[1] == "ER02":
|
||||||
msg = data[2]
|
msg = data[2]
|
||||||
|
|||||||
Reference in New Issue
Block a user