def finalize_bet(self, val): stack = self.our_stack() remaining = stack - val if remaining > 0 and mu.percentage(remaining, stack) < 25: self.bot.log(" increased bet by {} to all-in".format(remaining)) val = stack return int(round(val))
def pick_action(self, equity, to_call, pot_odds): """Look at our expected return and do something. Will be a semi-random mix of betting, folding, calling""" # action to us: check or bet if to_call == 0: # lock hands - 1/3 of the time make a small bet instead of a big one if equity > 90 and self.r_test(0.33, 'lock_trap'): self.make_bet(self.minimum_bet("trap1")) elif equity > 65 or (equity > 40 and self.r_test(0.03, 'c1')): self.make_bet(self.big_raise("R1")) elif equity > 55 or self.r_test(0.02, 'c2'): self.make_bet(self.minimum_bet("R2")) else: self.bot.check() # TODO: combine these and make them aware of button # use pot odds to call/bet/fold else: return_ratio = equity / pot_odds self.bot.log(" return ratio={:.3f}".format(return_ratio)) if equity > 70 or (equity > 40 and self.r_test(0.03, 'po1')): self.make_bet(self.big_raise("R3")) elif to_call < self.data.big_blind and \ (equity > 55 or self.r_test(0.03, 'po2')): # small preflop raise from SB, get more money into the pot self.make_bet(self.minimum_bet("R4")) elif return_ratio > 1.25: self.bot.log(" return ratio > 1.25, calling {}".format(to_call)) self.bot.call(to_call) elif return_ratio > 1 \ and MathUtils.percentage(to_call, self.our_stack()) < 10: self.bot.log(" return ratio > 1 and bet is small, calling {}" .format(to_call)) self.bot.call(to_call) else: self.bot.fold()
def pot_odds(self): """Return the pot odds, or how much we need to gain to call""" to_call = min(self.to_call(), self.our_stack()) return mu.percentage(to_call, self.data.pot + to_call)
def bet_percent(values): return mu.percentage(values.bet, values.pot)
def pot_odds(self): """Return the pot odds, or how much we need to gain to call""" to_call = self.data.sidepot pot_total = to_call + self.data.pot return MathUtils.percentage(to_call, pot_total)