Standing bug should be fixed

This commit is contained in:
2023-02-12 19:02:22 +10:00
parent 569a32660a
commit 7551d9b63b
2 changed files with 6 additions and 2 deletions

View File

@@ -135,9 +135,7 @@ class BlackJack:
return gameOver return gameOver
async def play_game(self, ID, bet, recv, send): async def play_game(self, ID, bet, recv, send):
validInput = False
gameOver = False gameOver = False
playerStood = False
playerStats = self.ledger.readLedger(ID) playerStats = self.ledger.readLedger(ID)
if playerStats is None: if playerStats is None:
self.ledger.writeLedger(ID) self.ledger.writeLedger(ID)
@@ -145,6 +143,10 @@ class BlackJack:
self.deal() self.deal()
while not gameOver: while not gameOver:
play = None
playerStood = False
validInput = False
playerWinState = self.checkHandState(self.playerHand) playerWinState = self.checkHandState(self.playerHand)
dealerWinState = self.checkHandState(self.dealerHand) dealerWinState = self.checkHandState(self.dealerHand)
gameOver = self.checkGameOver(playerWinState) or self.checkGameOver(dealerWinState) gameOver = self.checkGameOver(playerWinState) or self.checkGameOver(dealerWinState)
@@ -157,9 +159,11 @@ class BlackJack:
while not validInput: while not validInput:
if play == "h": if play == "h":
self.hit() self.hit()
print(f"Hit {self.playerTurn}")
validInput = True validInput = True
elif play == "s": elif play == "s":
self.stand() self.stand()
print(f"stood {self.playerTurn}")
validInput = True validInput = True
playerStood = True playerStood = True