clean loop with cleared hand

This commit is contained in:
2025-10-29 21:13:30 +01:00
parent 197572567a
commit a0175343f9
3 changed files with 5 additions and 8 deletions

View File

@@ -104,6 +104,8 @@ class Game:
player = self.player player = self.player
dealer = self.dealer dealer = self.dealer
player.hand.__init__()
dealer.hand.__init__()
# beginning of a round, shuffle deck and deal cards # beginning of a round, shuffle deck and deal cards
deck.shuffle() deck.shuffle()
@@ -129,5 +131,3 @@ class Game:
self.show_cards() self.show_cards()
print(self.compare_hands(0)) print(self.compare_hands(0))
player.hand.clear_hand()
dealer.hand.clear_hand()

View File

@@ -32,7 +32,3 @@ class Hand:
if self.value > 21 and self.aces > 0: if self.value > 21 and self.aces > 0:
self.value -= 10 self.value -= 10
self.aces -= 1 self.aces -= 1
def clear_hand(self) -> None:
"""Clears the hand"""
self.cards = []

View File

@@ -8,5 +8,6 @@ if __name__ == "__main__":
print("do you wanna play a round??") print("do you wanna play a round??")
game = Game() game = Game()
while True:
os.system("clear")
game.play_round() game.play_round()