Compare commits
10
Commits
v0.1.0
...
c225161374
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c225161374 | ||
|
|
e7c8d99c96 | ||
|
|
cef9468ad0 | ||
|
|
0682ad88ce | ||
|
|
a6a256992e | ||
|
|
1fcf01152d | ||
|
|
2fa0aa8a95 | ||
|
|
73e8747b73 | ||
|
|
14f1ebbd29 | ||
|
|
7e3639ab12 |
@@ -122,6 +122,16 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple:
|
|||||||
return data
|
return data
|
||||||
elif inp == "k":
|
elif inp == "k":
|
||||||
global score
|
global score
|
||||||
|
|
||||||
|
if score == 0:
|
||||||
|
last_two = players[pointer][-2:]
|
||||||
|
if len(last_two) > 1:
|
||||||
|
last_two_sum = sum(last_two)
|
||||||
|
if last_two_sum == 0:
|
||||||
|
score = -sum(players[pointer])
|
||||||
|
clear()
|
||||||
|
input("Po třech nulových hodech bylo vaše skóre vynulováno.")
|
||||||
|
|
||||||
players[pointer].append(score)
|
players[pointer].append(score)
|
||||||
aggr[pointer] = sum(players[pointer])
|
aggr[pointer] = sum(players[pointer])
|
||||||
score = 0
|
score = 0
|
||||||
@@ -133,6 +143,9 @@ def evaluate(inp: Any, count: int, throw: str) -> tuple:
|
|||||||
if winner:
|
if winner:
|
||||||
data = ("win", winner, aggr[winner])
|
data = ("win", winner, aggr[winner])
|
||||||
return data
|
return data
|
||||||
|
elif inp == "exit":
|
||||||
|
data = ("exit",)
|
||||||
|
return data
|
||||||
else:
|
else:
|
||||||
data = ("msg", "ER03", "Zadejte prosím platnou hodnotu:", count, throw)
|
data = ("msg", "ER03", "Zadejte prosím platnou hodnotu:", count, throw)
|
||||||
return data
|
return data
|
||||||
@@ -222,7 +235,18 @@ def game(data: tuple):
|
|||||||
th = throw(count)
|
th = throw(count)
|
||||||
clear()
|
clear()
|
||||||
print(f"Vítězné skóre: {final_score}.")
|
print(f"Vítězné skóre: {final_score}.")
|
||||||
print(f"Na tahu je {pointer} ({aggr[pointer]}).")
|
|
||||||
|
strikes = ""
|
||||||
|
|
||||||
|
if len(players[pointer]) > 0:
|
||||||
|
if players[pointer][-1:][0] == 0:
|
||||||
|
strikes = "x"
|
||||||
|
if players[pointer][-2:][0] == 0:
|
||||||
|
strikes += "x"
|
||||||
|
else:
|
||||||
|
strikes = ""
|
||||||
|
|
||||||
|
print(f"Na tahu je {pointer} ({aggr[pointer]}{strikes}).")
|
||||||
print(show_throw(th))
|
print(show_throw(th))
|
||||||
if not check_value(th) and data[2] == "" and count != 0:
|
if not check_value(th) and data[2] == "" and count != 0:
|
||||||
global score
|
global score
|
||||||
@@ -236,6 +260,7 @@ def game(data: tuple):
|
|||||||
" - Zadejte kombinaci kostek k ponechání (dojde k jejich vyhodnocení): [pozice kostek] (např. 1 nebo 34 nebo 123456).\n"
|
" - Zadejte kombinaci kostek k ponechání (dojde k jejich vyhodnocení): [pozice kostek] (např. 1 nebo 34 nebo 123456).\n"
|
||||||
" - Hodit znovu: [h].\n"
|
" - Hodit znovu: [h].\n"
|
||||||
f" - Ukončit hod a ponechat si skóre z tohoto hodu ({score}): [k].\n"
|
f" - Ukončit hod a ponechat si skóre z tohoto hodu ({score}): [k].\n"
|
||||||
|
" - Ukončit hru: [exit].\n"
|
||||||
)
|
)
|
||||||
inp = input(msg)
|
inp = input(msg)
|
||||||
data = evaluate(inp, count, th)
|
data = evaluate(inp, count, th)
|
||||||
@@ -245,7 +270,7 @@ def game(data: tuple):
|
|||||||
msg = data[2]
|
msg = data[2]
|
||||||
count = data[3]
|
count = data[3]
|
||||||
th = data[4]
|
th = data[4]
|
||||||
clear()
|
# clear()
|
||||||
inp = input(msg)
|
inp = input(msg)
|
||||||
data = evaluate(inp, count, th)
|
data = evaluate(inp, count, th)
|
||||||
else:
|
else:
|
||||||
@@ -262,6 +287,11 @@ def game(data: tuple):
|
|||||||
print("Díky za hru a zase příště.")
|
print("Díky za hru a zase příště.")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
elif data[0] == "exit":
|
||||||
|
clear()
|
||||||
|
print("Hra byla předčasně ukončena. Snad se zase brzy uvidíme.")
|
||||||
|
break
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
clear()
|
clear()
|
||||||
print("Vítejte ve hře v kostky!")
|
print("Vítejte ve hře v kostky!")
|
||||||
|
|||||||
Reference in new issue
Block a user