TuringsSolutions commited on
Commit
b9691be
1 Parent(s): ab9fb22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -82,7 +82,7 @@ class PokerSwarm:
82
  best_strategy = max(self.swarm, key=lambda x: x['win_prob'])
83
  return best_strategy['strategy'], best_strategy['win_prob']
84
 
85
- def predict_optimal_strategy(player_hand, pot_size, chips, n_opponents, flop_cards):
86
  player_hand = player_hand.split(',')
87
  flop_cards = flop_cards.split(',')
88
 
@@ -90,7 +90,7 @@ def predict_optimal_strategy(player_hand, pot_size, chips, n_opponents, flop_car
90
  deck = [r + s for r in '23456789TJQKA' for s in 'SHDC']
91
  deck = [card for card in deck if card not in player_hand + flop_cards]
92
 
93
- poker_swarm = PokerSwarm(n_particles=30, n_iterations=50, n_simulations=1000, player_hand=player_hand, pot_size=int(pot_size), chips=int(chips), n_opponents=int(n_opponents), flop_cards=flop_cards)
94
  optimal_strategy, optimal_win_prob = poker_swarm.optimize()
95
  return optimal_strategy, f'{optimal_win_prob:.2%}'
96
 
@@ -100,7 +100,8 @@ inputs = [
100
  gr.components.Textbox(label="Pot Size"),
101
  gr.components.Textbox(label="Player's Amount of Chips"),
102
  gr.components.Textbox(label="Number of Opponents"),
103
- gr.components.Textbox(label="Flop Cards (comma-separated, e.g., '2H,7D,9C')")
 
104
  ]
105
 
106
  outputs = [
 
82
  best_strategy = max(self.swarm, key=lambda x: x['win_prob'])
83
  return best_strategy['strategy'], best_strategy['win_prob']
84
 
85
+ def predict_optimal_strategy(player_hand, pot_size, chips, n_opponents, flop_cards, n_simulations):
86
  player_hand = player_hand.split(',')
87
  flop_cards = flop_cards.split(',')
88
 
 
90
  deck = [r + s for r in '23456789TJQKA' for s in 'SHDC']
91
  deck = [card for card in deck if card not in player_hand + flop_cards]
92
 
93
+ poker_swarm = PokerSwarm(n_particles=30, n_iterations=50, n_simulations=int(n_simulations), player_hand=player_hand, pot_size=int(pot_size), chips=int(chips), n_opponents=int(n_opponents), flop_cards=flop_cards)
94
  optimal_strategy, optimal_win_prob = poker_swarm.optimize()
95
  return optimal_strategy, f'{optimal_win_prob:.2%}'
96
 
 
100
  gr.components.Textbox(label="Pot Size"),
101
  gr.components.Textbox(label="Player's Amount of Chips"),
102
  gr.components.Textbox(label="Number of Opponents"),
103
+ gr.components.Textbox(label="Flop Cards (comma-separated, e.g., '2H,7D,9C')"),
104
+ gr.components.Textbox(label="Number of Simulated Hands")
105
  ]
106
 
107
  outputs = [