Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,6 +104,9 @@ result = st.empty()
|
|
| 104 |
pro_tip = st.empty()
|
| 105 |
betting_strategy = st.empty()
|
| 106 |
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
while True:
|
| 109 |
if 'Hit' in player.possible_actions:
|
|
@@ -136,5 +139,8 @@ while True:
|
|
| 136 |
pro_tip.write(display_pro_tip(player, dealer))
|
| 137 |
betting_strategy.write(display_betting_strategy(player, dealer))
|
| 138 |
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
| 140 |
break
|
|
|
|
| 104 |
pro_tip = st.empty()
|
| 105 |
betting_strategy = st.empty()
|
| 106 |
|
| 107 |
+
def calculate_hand_total(hand):
|
| 108 |
+
total = sum(card.rank for card in hand)
|
| 109 |
+
return total
|
| 110 |
|
| 111 |
while True:
|
| 112 |
if 'Hit' in player.possible_actions:
|
|
|
|
| 139 |
pro_tip.write(display_pro_tip(player, dealer))
|
| 140 |
betting_strategy.write(display_betting_strategy(player, dealer))
|
| 141 |
|
| 142 |
+
player_total = calculate_hand_total(player.cards)
|
| 143 |
+
dealer_total = calculate_hand_total(dealer.cards)
|
| 144 |
+
|
| 145 |
+
if player_total == 21 or dealer_total == 21 or not player.possible_actions:
|
| 146 |
break
|