Fixed multiple session bug for blackjack
This commit is contained in:
@@ -198,6 +198,7 @@ class BlackJack:
|
||||
self.playerHand = Hand()
|
||||
self.dealerHand = Hand()
|
||||
self.ledger = Ledger()
|
||||
self.playing = False
|
||||
|
||||
def deal_card(self, hand):
|
||||
hand.add_to_hand(self.deck.take_from_deck())
|
||||
@@ -227,6 +228,12 @@ class BlackJack:
|
||||
await send(string)
|
||||
|
||||
async def play_game(self, ID, bet, recv, send):
|
||||
|
||||
if self.playing:
|
||||
await send("Game in Progress")
|
||||
return
|
||||
else:
|
||||
self.playing = True
|
||||
gameState = INIT
|
||||
|
||||
while gameState != OVER:
|
||||
@@ -328,6 +335,7 @@ class BlackJack:
|
||||
self.deck.shuffle()
|
||||
await send("Everyday I'm shuffling")
|
||||
gameState = OVER
|
||||
self.playing = False
|
||||
|
||||
def main():
|
||||
game = BlackJack()
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user