Files
pokerfreak/src/exploit/fold_chance.rs
T
mmintelandClaude Opus 5.5 1ad6f76088 Bluffing and bluff catching driven by opponent frequencies
- exploit::fold_chance: documented foldToBet -> P(fold) map by bet size, per villain
- engine: two-branch EV for every raise (fold branch, called branch vs calling range)
- semibluffs first, pure bluffs heads-up above a fold and EV threshold
- betting ranges keep a bluff share (size, street, style or new profile.aggression)
- guards: no bluffs vs never-folders, no bluff catch vs ranges without bluffs
- steal width in unopened pots from how often the blinds fold
- combo-list sampling for narrow two-card ranges

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 13:11:38 +01:00

57 lines
2.3 KiB
Rust

//! How likely one opponent folds to a bet: the documented map from their profile.
//!
//! | step | rule |
//! |---|---|
//! | base `f` | `foldToBet`, clamped to [0, 1]; without it the style default: nit 0.65, calling station 0.20, loose-aggressive 0.40, otherwise 0.45 |
//! | size | `p = 1 - (1 - f)^(ratio / 0.66)`: foldToBet is a frequency against a typical two-thirds-pot bet, so at that size `p = f`; smaller bets fold less, bigger more, a zero bet never |
//! | raised | `p * 0.7` when the opponent already bet and is being raised (money invested, range stronger) |
//! | cap | at most 0.95: nobody folds for sure |
//!
//! `ratio` is the pressure: chips beyond a call over the pot after calling
//! (`table_fold::pressure_ratio`).
use super::profile::Profile;
use super::style::{classify, Style};
/// Bet size (pot fraction) at which foldToBet is taken to be measured.
pub const REFERENCE_RATIO: f64 = 0.66;
/// Fold-to-bet of an opponent we know nothing about.
pub const DEFAULT_FOLD_TO_BET: f64 = 0.45;
/// Factor when the opponent is raised after betting.
pub const RAISE_RESISTANCE: f64 = 0.7;
/// Largest fold chance ever assumed for one opponent.
pub const MAX_FOLD: f64 = 0.95;
fn style_default(style: Style) -> f64 {
match style {
Style::Nit => 0.65,
Style::CallingStation => 0.20,
Style::LooseAggressive => 0.40,
Style::Regular | Style::Unknown => DEFAULT_FOLD_TO_BET,
}
}
/// The opponent's fold-to-bet at the reference size.
pub fn fold_base(profile: Option<&Profile>) -> f64 {
match profile {
None => DEFAULT_FOLD_TO_BET,
Some(p) => match p.fold_to_bet.filter(|f| !f.is_nan()) {
Some(f) => f.clamp(0.0, 1.0),
None => style_default(classify(p)),
},
}
}
/// P(this opponent folds) to a bet of `ratio` pots. Total: any input gives `[0, MAX_FOLD]`.
pub fn fold_chance(profile: Option<&Profile>, ratio: f64, facing_raise: bool) -> f64 {
let f = fold_base(profile);
let ratio = if ratio.is_nan() { 0.0 } else { ratio.max(0.0) };
let sized = if f >= 1.0 {
if ratio > 0.0 { 1.0 } else { 0.0 }
} else {
1.0 - (1.0 - f).powf(ratio / REFERENCE_RATIO)
};
let raised = if facing_raise { sized * RAISE_RESISTANCE } else { sized };
if raised.is_nan() { 0.0 } else { raised.clamp(0.0, MAX_FOLD) }
}