Don't let the computer lose if it happens to roll past 100

This commit is contained in:
Firepup Sixfifty 2024-11-13 11:28:49 -06:00
parent 3575927c85
commit f57810163f
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48

View file

@ -51,7 +51,7 @@ def doRound(turn, canCheat, player, computer):
bank += res[1] bank += res[1]
print(f"Computer roll {rollCounter}:") print(f"Computer roll {rollCounter}:")
print(f"Computer rolled a {res[1]}, bank is now {bank}") print(f"Computer rolled a {res[1]}, bank is now {bank}")
shouldRoll = fp.randint(0, 1) shouldRoll = fp.randint(0, 1) if (bank+computer < 100) else 0
else: else:
rollCounter += 1 rollCounter += 1
print(f"Computer roll {rollCounter}:") print(f"Computer roll {rollCounter}:")
@ -60,7 +60,7 @@ def doRound(turn, canCheat, player, computer):
break break
bank += res[0] bank += res[0]
print(f"Computer rolled a {res[0]}, bank is now {bank}") print(f"Computer rolled a {res[0]}, bank is now {bank}")
shouldRoll = fp.randint(0, 1) shouldRoll = fp.randint(0, 1) if (bank+computer < 100) else 0
if not shouldRoll: if not shouldRoll:
print( print(
f"Computer stopped rolling after {rollCounter} roll(s), bank was {bank} points{' (!! CHEAT !!)' if cheatFlag else ''}" f"Computer stopped rolling after {rollCounter} roll(s), bank was {bank} points{' (!! CHEAT !!)' if cheatFlag else ''}"