From 8af654353bd7a75ab076fe5d9bbbc7e9d53cabe8 Mon Sep 17 00:00:00 2001 From: Adam <24621027+WhiteDopeOnPunk@users.noreply.github.com> Date: Thu, 29 Dec 2022 22:27:38 -0500 Subject: [PATCH] new shit has come to light, man --- blackjack.py | 3 +++ readme.md | 1 + src/gamemaster.py | 2 ++ src/io.py | 9 ++++++--- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/blackjack.py b/blackjack.py index 1a57d41..6e9e30c 100644 --- a/blackjack.py +++ b/blackjack.py @@ -18,6 +18,9 @@ def main(): while game.active: ui.update(game) + for player in game.players: + if player.blackjack(game): + game.active = False if game.active: match ui.player_move(deck).lower(): diff --git a/readme.md b/readme.md index f542c3c..feff7d1 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,4 @@ +Need Python >= 3.10 ``` .oPYo. 8 8 o 8 8 `8 8 8 8 8 diff --git a/src/gamemaster.py b/src/gamemaster.py index f51b9c3..7319b1a 100644 --- a/src/gamemaster.py +++ b/src/gamemaster.py @@ -6,6 +6,7 @@ class GameMaster: self.players = [Player('Dealer'), Player('Player')] # 5-9 seats self.dealer = self.players[0] self.player = self.players[1] + self.blackjack = False def score(self): status = 'Error' @@ -26,6 +27,7 @@ class GameMaster: status = player.name + ' Bust!' elif player.blackjack(self): self.active = False + self.blackjack = True status = player.name + ' has Blackjack!' return status diff --git a/src/io.py b/src/io.py index e75333b..36e1c11 100644 --- a/src/io.py +++ b/src/io.py @@ -92,9 +92,12 @@ o8YooP' 8 .oPYo. .oPYo. 8 .o 8 .oPYo. .oPYo. 8 .o def update(self, game): print(self.clear + self.title + - self.show_players(game) +\ - ('\n'+game.score() if not game.active else '')) - + self.show_players(game)) + for player in game.players: + if player.blackjack(game): + game.active = False + if not game.active: + print(game.score()) def get_decks(self): return input('How many decks? (1-8): ')