Files
pokerfreak/src/exploit/fold_chance.rs
T
mmintelandClaude Opus 5.5 0deb2e10de Gegnermodell: MDF-Fix, Strassen- und Linien-Reads, leichter 3-Bet, Leiter-Infrastruktur
Bewiesen auf der gepaarten Leiter (19 Gegner, 95 %-CI, kein Profil verliert):
- MDF-Floor/Veto-Fix: in der Sim bit-identisch, echte Haende Overfold 36 -> 7.5 bb.
- Aggressions-Vertrauen, Strassen-Reads (Turn/River-Aggression, Fold-auf-Bet je Strasse,
  Bayes-geschrumpft zum Gesamt-Read), Zug-Logging der Gegnerprofile, Replay mit geloggten Profilen.
- Leichter 3-Bet gegen 3-Bet-Folder (EV-Break-even risk/(pot+risk)): +6.62 +-5.23 bb/100
  gegen den 3-Bet-Folder, sonst unveraendert.
- Fold-auf-C-Bet preist die C-Bet: neutral.
- Welt-Archetypen cbet-folder, 3bet-folder, check-raiser; ab_zelle (Zellen-Leiter, fortsetzbar),
  Warteschlange mit Thread-Budget, ab.py.

Nicht drin: der Check-Raise-Abschlag (drei Varianten, keine sauber; wird durch ein
Spielbaum-Modell ersetzt), der River-Showdown-Read bleibt aus (Verlierer -1.31).
Ergebnisse: messung_engine/ERGEBNISSE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 21:27:08 +01:00

106 lines
4.9 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, station_trust, Style};
use crate::game::Street;
/// 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.
///
/// A `CallingStation` read is trust-weighted (`station_trust`): a misclassified aggressive "station"
/// (nemesis-2, fold-to-bet 0.56 read, aggr 0.41) only partly trusts its high fold frequency, so hero
/// does not over-barrel into a light-raising range whose multi-street cost the single-street bluff-EV
/// never models. A genuine station (trust 1.0) is bit-identical to the raw read.
pub fn fold_base(profile: Option<&Profile>) -> f64 {
fold_base_on(profile, None)
}
/// `fold_base`, but on `street` the per-street (already pooled-shrunk) fold read replaces the raw
/// pooled one when the profile carries it. Station trust applies on top, as for the pooled read.
pub fn fold_base_on(profile: Option<&Profile>, street: Option<Street>) -> f64 {
match profile {
None => DEFAULT_FOLD_TO_BET,
Some(p) => {
let per_street = street
.and_then(|s| match s {
Street::Flop => Some(0),
Street::Turn => Some(1),
Street::River => Some(2),
Street::Preflop => None,
})
.and_then(|i| p.street_fold_to_bet[i])
.filter(|f| !f.is_nan());
let raw = match per_street.or(p.fold_to_bet.filter(|f| !f.is_nan())) {
Some(f) => f.clamp(0.0, 1.0),
None => style_default(classify(p)),
};
if classify(p) == Style::CallingStation {
DEFAULT_FOLD_TO_BET + station_trust(p) * (raw - DEFAULT_FOLD_TO_BET)
} else {
raw
}
}
}
}
/// 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 {
fold_chance_on(profile, ratio, facing_raise, None)
}
/// Fold base against hero's continuation bet: the opponent's fold-to-c-bet read when it carries one
/// (a calling station's is trust-damped like its pooled read), else the flop read (`fold_base_on`).
/// A c-bet folder gives up the flop far more often than its pooled fold-to-bet says, and a sticky
/// flop caller far less.
pub fn fold_base_cbet(profile: Option<&Profile>) -> f64 {
match profile.and_then(|p| p.fold_to_cbet.filter(|f| !f.is_nan()).map(|f| (p, f.clamp(0.0, 1.0)))) {
Some((p, f)) if classify(p) == Style::CallingStation => DEFAULT_FOLD_TO_BET + station_trust(p) * (f - DEFAULT_FOLD_TO_BET),
Some((_, f)) => f,
None => fold_base_on(profile, Some(Street::Flop)),
}
}
/// `fold_chance` with the street's own fold read (`fold_base_on`).
pub fn fold_chance_on(profile: Option<&Profile>, ratio: f64, facing_raise: bool, street: Option<Street>) -> f64 {
sized_fold(fold_base_on(profile, street), ratio, facing_raise)
}
/// P(fold) to a bet of `ratio` pots from a fold base `f` (the reference-size fold rate).
pub fn sized_fold(f: f64, ratio: f64, facing_raise: bool) -> f64 {
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) }
}