awacke1 commited on
Commit
ca61840
1 Parent(s): 32c96cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -2
app.py CHANGED
@@ -57,10 +57,36 @@ def start_game():
57
  game_deck, dealer, player, game_play = start_game()
58
 
59
  def display_pro_tip(player, dealer):
60
- # ... (same as before)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  def display_betting_strategy(player, dealer):
63
- # ... (same as before)
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  def calculate_hand_total(hand):
66
  total = sum(card.rank for card in hand)
 
57
  game_deck, dealer, player, game_play = start_game()
58
 
59
  def display_pro_tip(player, dealer):
60
+ player_total = sum(card.rank for card in player.cards)
61
+
62
+ if dealer.cards:
63
+ dealer_upcard = dealer.cards[0].rank
64
+ else:
65
+ dealer_upcard = 0
66
+
67
+ if player_total <= 11:
68
+ return "Pro Tip: With a total of 11 or less, it's generally advisable to hit."
69
+ elif player_total == 12 and dealer_upcard <= 3:
70
+ return "Pro Tip: With a total of 12 and the dealer showing 3 or less, consider hitting."
71
+ elif player_total >= 17:
72
+ return "Pro Tip: With a total of 17 or more, it's usually best to stand."
73
+ else:
74
+ return ""
75
 
76
  def display_betting_strategy(player, dealer):
77
+ player_total = sum(card.rank for card in player.cards)
78
+
79
+ if dealer.cards:
80
+ dealer_upcard = dealer.cards[0].rank
81
+ else:
82
+ dealer_upcard = 0
83
+
84
+ if player_total <= 11:
85
+ return "Betting Strategy: Consider increasing your bet when your total is 11 or less."
86
+ elif player_total >= 17 and dealer_upcard <= 6:
87
+ return "Betting Strategy: Consider increasing your bet when you have a strong hand and the dealer has a weak upcard."
88
+ else:
89
+ return ""
90
 
91
  def calculate_hand_total(hand):
92
  total = sum(card.rank for card in hand)