//! What part of an opponent's betting range is a bluff. //! //! | step | rule | //! |---|---| //! | base | `s / (1 + 2s)` for a bet of `s` pots: the river share at which a caller is indifferent (Chen/Ankenman, "The Mathematics of Poker"); unknown or broken size counts as 0.66 | //! | street | river 1.0, turn 0.6, flop 0.5 (earlier, draws do the bluffing and already stay in the range), preflop 0 | //! | style | nit 0.4, calling station 0.5 (passive players bet for value), loose-aggressive 1.5, otherwise 1.0 | //! | aggression | when the profile gives it, `aggression / 0.45` (0.45 = an average aggression frequency) replaces the style factor, clamped to [0, 2] | //! | cap | at most 0.6 | use super::profile::Profile; use super::style::{classify, Style}; use crate::game::Street; pub const NEUTRAL_RATIO: f64 = 0.66; pub const MAX_BLUFF_SHARE: f64 = 0.6; const AVERAGE_AGGRESSION: f64 = 0.45; const MAX_FACTOR: f64 = 2.0; fn street_factor(street: Street) -> f64 { match street { Street::Preflop => 0.0, Street::Flop => 0.5, Street::Turn => 0.6, Street::River => 1.0, } } fn style_factor(profile: Option<&Profile>) -> f64 { let Some(p) = profile else { return 1.0 }; match p.aggression.filter(|a| !a.is_nan()) { Some(a) => (a.clamp(0.0, 1.0) / AVERAGE_AGGRESSION).clamp(0.0, MAX_FACTOR), None => match classify(p) { Style::Nit => 0.4, Style::CallingStation => 0.5, Style::LooseAggressive => 1.5, Style::Regular | Style::Unknown => 1.0, }, } } /// Bluff share of the range that bet `ratio` pots on `street`. Always in `[0, MAX_BLUFF_SHARE]`. pub fn bluff_share(profile: Option<&Profile>, ratio: Option, street: Street) -> f64 { let s = ratio.filter(|r| r.is_finite() && *r > 0.0).unwrap_or(NEUTRAL_RATIO); let balanced = s / (1.0 + 2.0 * s); (balanced * street_factor(street) * style_factor(profile)).clamp(0.0, MAX_BLUFF_SHARE) }