use super::range_narrowing::{bet_factor, multiway_factor, stickiness_factor, street_factor}; use crate::game::{Spot, Villain}; /// Baseline when the villain has no vpip figure (typical full-ring/six-max regular). pub const DEFAULT_VPIP: f64 = 0.30; const MIN_FRACTION: f64 = 0.05; /// Estimated fraction of starting hands (best first) this villain still holds here, /// in `(0, 1]`. Used as `VillainRange::Top` for the equity estimate. /// /// `vpip` (default 0.30) x street (1,.8,.62,.5) x bet size (`to_call / pot`, narrower) /// x multiway-passive bonus x stickiness (foldToBet), clamped to `[0.05, 1]`. pub fn top_fraction(spot: &Spot, villain: &Villain) -> f64 { let profile = villain.profile.unwrap_or_default(); let vpip = profile .vpip .filter(|v| !v.is_nan()) .map_or(DEFAULT_VPIP, |v| v.clamp(0.02, 1.0)); let someone_bet = spot.to_call > 0.0; let live = spot.live_villains().count(); (vpip * street_factor(spot.street) * bet_factor(spot.to_call, spot.pot) * multiway_factor(live, someone_bet) * stickiness_factor(profile.fold_to_bet)) .clamp(MIN_FRACTION, 1.0) }