use super::fold_chance::{fold_base, DEFAULT_FOLD_TO_BET}; use crate::game::Spot; /// Width change per point of average fold-to-bet above the neutral 0.45. const PER_FOLD: f64 = 1.5; const BOUNDS: (f64, f64) = (0.7, 1.4); /// Opening-width multiplier for an unopened pot, from how often the players behind fold: /// `1 + 1.5 * (mean fold_base - 0.45)`, clamped to [0.7, 1.4]. Nits behind widen the /// steal, calling stations narrow it; no villain or no profiles: 1.0. pub fn steal_width(spot: &Spot) -> f64 { let folds: Vec = spot.live_villains().map(|v| fold_base(v.profile.as_ref())).collect(); width_from_folds(&folds) } /// The opening-width multiplier from the fold bases of the players behind (see `steal_width`). pub fn width_from_folds(folds: &[f64]) -> f64 { if folds.is_empty() { return 1.0; } let mean = folds.iter().sum::() / folds.len() as f64; let w = (1.0 + PER_FOLD * (mean - DEFAULT_FOLD_TO_BET)).clamp(BOUNDS.0, BOUNDS.1); if steal_wert() { w.max(1.0) } else { w } } /// Schalter `STEAL_BREITE=wert` (17.11., Tor "Information schadet nie"; einmal gelesen): gegen Spieler, die /// weniger folden, wird nicht enger geoeffnet. Wer weniger foldet, callt mit schwaecheren Haenden; der /// Raise verliert Foldequity, gewinnt aber Wert gegen die breitere Calling-Range. Die Verengung kannte nur die /// Foldequity: mit dem WAHREN Read (Orakel) limpte der SB 6 % statt zu raisen und das BB raiste gegen einen /// Limp gar nicht mehr (station -10,1 und -4,2 bb/100 in diesen Zellen). Mehr Breite gegen Folder bleibt. pub fn steal_wert() -> bool { use std::sync::OnceLock; static AN: OnceLock = OnceLock::new(); *AN.get_or_init(|| std::env::var("STEAL_BREITE").as_deref() == Ok("wert")) }