clean loop with cleared hand
This commit is contained in:
@@ -104,6 +104,8 @@ class Game:
|
||||
player = self.player
|
||||
dealer = self.dealer
|
||||
|
||||
player.hand.__init__()
|
||||
dealer.hand.__init__()
|
||||
# beginning of a round, shuffle deck and deal cards
|
||||
|
||||
deck.shuffle()
|
||||
@@ -129,5 +131,3 @@ class Game:
|
||||
self.show_cards()
|
||||
|
||||
print(self.compare_hands(0))
|
||||
player.hand.clear_hand()
|
||||
dealer.hand.clear_hand()
|
||||
|
||||
@@ -32,7 +32,3 @@ class Hand:
|
||||
if self.value > 21 and self.aces > 0:
|
||||
self.value -= 10
|
||||
self.aces -= 1
|
||||
|
||||
def clear_hand(self) -> None:
|
||||
"""Clears the hand"""
|
||||
self.cards = []
|
||||
|
||||
@@ -8,5 +8,6 @@ if __name__ == "__main__":
|
||||
print("do you wanna play a round??")
|
||||
|
||||
game = Game()
|
||||
|
||||
while True:
|
||||
os.system("clear")
|
||||
game.play_round()
|
||||
|
||||
Reference in New Issue
Block a user