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>
281 lines
14 KiB
Rust
281 lines
14 KiB
Rust
//! Minimum-defence-frequency floor: on the river, a made hand in the top `1 - alpha` of a
|
||
//! defensible range is never folded to a bet, whatever the opponent range model says.
|
||
//!
|
||
//! This is the GTO floor UNDER the exploit deviation. Facing a bet of break-even `alpha`
|
||
//! (`to_call / (pot + to_call)`), a defender who folds more than `1 - alpha` of the hands that
|
||
//! beat a bluff lets the bettor print with any air (MDF). The engine's villain range model is
|
||
//! measured to be too value-heavy (replay benchmark: mean equity bias ~-0.22, river fold-to-bet
|
||
//! ~86 %), so equity-against-the-model folds bluff-catchers that MDF says must defend. This floor
|
||
//! reads HERO's own made hand - not the (untrusted) villain range - so it can never be moved by a
|
||
//! miscalibrated read: it only ever turns a model-driven fold into the call MDF requires.
|
||
//!
|
||
//! River only: there the bet is terminal and MDF is exact (no draws, no future streets, realisation
|
||
//! 1.0). Flop and turn defence couples with realisation and is left to the equity line.
|
||
|
||
use crate::exploit::profile::Profile;
|
||
use crate::game::{ActionKind, Choice, Decision, Spot, Street};
|
||
use crate::odds::break_even::break_even;
|
||
use crate::read::made::Made;
|
||
|
||
/// At or above this observed postflop aggression the bettor bets and raises more than a value range
|
||
/// supports, so MDF defence of a bluff-catcher is owed. Set BETWEEN a balanced range player's
|
||
/// measured aggression and a genuine over-bluffer's: the near-GTO opponents read ~0.35-0.40
|
||
/// (gto Memory 0.35, Oracle 0.40; gto-small lower), a maniac reads ~0.49-0.50 (Memory 0.49, Oracle
|
||
/// 0.50). A threshold of 0.45 trips the maniac and spares the balanced player.
|
||
const OVER_BLUFF_AGGRESSION: f64 = 0.45;
|
||
|
||
/// Fraction of random hands hero's made class beats by showdown - the MDF yardstick (rough,
|
||
/// monotone in `Made`). Not an equity: only its order and rough level matter, to place the hand
|
||
/// in hero's range (`strength >= alpha` ⇔ top `1 - alpha`).
|
||
fn strength(made: Made) -> f64 {
|
||
match made {
|
||
Made::Air => 0.15,
|
||
Made::BoardOnly => 0.18,
|
||
Made::Underpair => 0.42,
|
||
Made::BottomPair => 0.50,
|
||
Made::MiddlePair => 0.60,
|
||
Made::TopPairWeakKicker => 0.70,
|
||
Made::TopPairGoodKicker => 0.80,
|
||
Made::Overpair => 0.85,
|
||
Made::TwoPair => 0.90,
|
||
Made::Set | Made::Trips => 0.95,
|
||
Made::Straight => 0.97,
|
||
Made::Flush => 0.98,
|
||
Made::FullHouse => 0.99,
|
||
Made::Quads => 0.995,
|
||
Made::StraightFlush => 1.0,
|
||
}
|
||
}
|
||
|
||
/// A hand with real showdown value: at least a pair, so it beats a pure bluff. `BoardOnly`
|
||
/// (hero plays the board, chops at best) and `Air` are not bluff-catchers and are excluded -
|
||
/// their MDF defence, if any, is a raise, never a call.
|
||
fn beats_bluffs(made: Made) -> bool {
|
||
made >= Made::Underpair
|
||
}
|
||
|
||
/// Positive, directly observed evidence that this bettor OVER-bluffs, so the range model's fold of a
|
||
/// bluff-catcher is wrong and MDF defence is owed: an observed postflop aggression frequency above
|
||
/// what a value range supports. This is the DIRECT bluff signal — bets and raises per postflop action
|
||
/// — not preflop range WIDTH.
|
||
///
|
||
/// Why width is excluded: an earlier version also fired on `classify == LooseAggressive`, which keys on
|
||
/// vpip ≥ 0.35 ∧ pfr ≥ 0.20 — preflop range width. Heads-up, a correctly balanced opponent plays a wide
|
||
/// range (button opens ~80 %, big blind defends ~70 %), so its MEASURED vpip/pfr read loose-aggressive
|
||
/// (gto session read vpip 0.70, pfr 0.46) even though its postflop aggression is only ~0.35 and its
|
||
/// bets are value-balanced. That width clause force-called the balanced opponent's value bets — the
|
||
/// −52 bb/100 over-call BEFUND-gto-ueberdefense first saw under the oracle read, resurfacing under the
|
||
/// realistic session read because the oracle vpip was hand-set to a narrow 0.32 but the session read
|
||
/// measures the true 0.70 (BEFUND-gto-ueberdefense-read). Range width ≠ bluff frequency; only measured
|
||
/// over-aggression earns the defence. The crown equation's trust region, defensive side: only a read
|
||
/// that says "this bettor bluffs too much" overrides the model's fold.
|
||
fn over_bluffs(profile: &Profile) -> bool {
|
||
profile.aggression.is_some_and(|a| a >= OVER_BLUFF_AGGRESSION)
|
||
}
|
||
|
||
/// Could the bet be bluff-heavy enough that MDF requires defending our bluff-catcher? Only against an
|
||
/// unread villain (the unread micro population bluffs) or a positively-identified over-bluffer. A
|
||
/// balanced / tight regular's bets are value-weighted, so the floor defers to the range model's fold
|
||
/// instead of force-calling - the floor is a response to *measured* over-bluffing, not a blanket
|
||
/// riegel against everyone who is not a nit.
|
||
fn range_may_bluff(spot: &Spot) -> bool {
|
||
let mut live = spot.villains.iter().filter(|v| !v.folded).peekable();
|
||
live.peek().is_none()
|
||
|| live.any(|v| v.profile.as_ref().is_none_or(|p| bluff_unread(p) || over_bluffs(p)))
|
||
}
|
||
|
||
/// A profile WITHOUT a postflop aggression read says nothing about bluffing (a live HUD often carries
|
||
/// only vpip/pfr): it is unread on the axis the floor needs, so it is defended exactly like an unread
|
||
/// villain. Only a measured aggression below the over-bluff line counts as evidence of a value-weighted
|
||
/// range. (Replay 10.11., hand 174898200346: vpip-only read, river top pair folded to a pair of tens,
|
||
/// 28.5 bb, because a missing aggression was read as "proven balanced".)
|
||
fn bluff_unread(profile: &Profile) -> bool {
|
||
profile.aggression.is_none_or(f64::is_nan)
|
||
|| profile.aggression_confidence.is_some_and(|c| c.is_nan() || c < AGGRESSION_READ_MIN)
|
||
}
|
||
|
||
/// An aggression read thinner than this (live: about 10 seen postflop moves at the 30-move half-life)
|
||
/// is no evidence either way: the same floor the river gearbox needs before it trusts a read.
|
||
const AGGRESSION_READ_MIN: f64 = 0.25;
|
||
|
||
/// True when hero must defend `made` against the bet he faces (never fold): on the river, with
|
||
/// a bluff-catcher or better, whose strength puts it in the top `1 - alpha` of the range, and the
|
||
/// bettor is not a confirmed under-bluffer.
|
||
pub fn defends(spot: &Spot, made: Made) -> bool {
|
||
spot.street == Street::River
|
||
&& spot.to_call > 0.0
|
||
&& beats_bluffs(made)
|
||
&& strength(made) >= break_even(spot.pot, spot.to_call)
|
||
&& range_may_bluff(spot)
|
||
}
|
||
|
||
/// Overlay the floor on a finished postflop decision: a model-driven river fold of a defensible
|
||
/// made hand becomes the call MDF requires. `spot` must carry the UNGATED villain reads - the
|
||
/// floor's defensive use of a read (fold more against a confirmed non-bluffer, never fold a
|
||
/// bluff-catcher the model mis-prices) is always safe, unlike the range model that `read_gate`
|
||
/// keeps blind. The base decision's EV annotations are kept; anything but a floorable river fold
|
||
/// is returned unchanged.
|
||
pub fn floor(spot: &Spot, made: Made, decision: Decision) -> Decision {
|
||
if decision.choice == Choice::Fold && spot.is_legal(ActionKind::Call) && defends(spot, made) {
|
||
let be = break_even(spot.pot, spot.to_call);
|
||
return Decision::new(
|
||
Choice::Call,
|
||
0.5,
|
||
format!("MDF-Boden: Made-Hand verteidigt - Modell-Fold uebersteuert (break-even {be:.2})"),
|
||
)
|
||
.with_evs(decision.evs);
|
||
}
|
||
decision
|
||
}
|
||
|
||
#[cfg(test)]
|
||
mod tests {
|
||
use super::*;
|
||
|
||
fn river(pot: f64, to_call: f64) -> Spot {
|
||
Spot {
|
||
variant: crate::variant::Variant::Nlhe,
|
||
big_blind: 0.1,
|
||
seats: 2,
|
||
hero_seat: 1,
|
||
button_seat: None,
|
||
hero_cards: crate::card::Card::parse_list("Kd 7d").unwrap(),
|
||
board: crate::card::Card::parse_list("9c Tc Kc Qd 2h").unwrap(),
|
||
street: Street::River,
|
||
pot,
|
||
to_call,
|
||
hero_stack: 100.0,
|
||
min_raise_to: None,
|
||
max_raise_to: None,
|
||
legal: vec![],
|
||
allowed_sizes: None,
|
||
villains: vec![],
|
||
seed: 1,
|
||
history: Vec::new(),
|
||
}
|
||
}
|
||
|
||
#[test]
|
||
fn top_pair_defends_a_half_pot_river_bet() {
|
||
// alpha = 0.26 / 0.83 = 0.31; top pair weak kicker strength 0.70 >= 0.31 -> defend
|
||
assert!(defends(&river(0.57, 0.26), Made::TopPairWeakKicker));
|
||
}
|
||
|
||
#[test]
|
||
fn weak_pair_folds_to_an_overbet() {
|
||
// alpha = 15 / 25 = 0.60; underpair strength 0.42 < 0.60 -> no floor
|
||
assert!(!defends(&river(10.0, 15.0), Made::Underpair));
|
||
}
|
||
|
||
#[test]
|
||
fn air_is_never_floored() {
|
||
assert!(!defends(&river(10.0, 3.0), Made::Air));
|
||
assert!(!defends(&river(10.0, 3.0), Made::BoardOnly));
|
||
}
|
||
|
||
#[test]
|
||
fn only_on_the_river() {
|
||
let flop = Spot { street: Street::Flop, ..river(10.0, 3.0) };
|
||
assert!(!defends(&flop, Made::TopPairGoodKicker));
|
||
}
|
||
|
||
#[test]
|
||
fn no_floor_without_a_bet() {
|
||
assert!(!defends(&river(10.0, 0.0), Made::Overpair));
|
||
}
|
||
|
||
fn villain(profile: Option<Profile>) -> crate::game::Villain {
|
||
crate::game::Villain { seat: 1, stack: 100.0, folded: false, profile }
|
||
}
|
||
|
||
fn prof(aggression: f64, vpip: f64, fold_to_bet: f64) -> Profile {
|
||
Profile {
|
||
aggression: Some(aggression),
|
||
vpip: Some(vpip),
|
||
fold_to_bet: Some(fold_to_bet),
|
||
..Profile::default()
|
||
}
|
||
}
|
||
|
||
#[test]
|
||
fn an_aggressive_bettor_is_defended() {
|
||
// alpha 0.33, middle pair 0.60 >= 0.33, and the maniac bets bluffs -> defend.
|
||
let spot = Spot { villains: vec![villain(Some(prof(0.8, 0.55, 0.35)))], ..river(12.0, 6.0) };
|
||
assert!(defends(&spot, Made::MiddlePair));
|
||
}
|
||
|
||
#[test]
|
||
fn an_unread_bettor_is_defended() {
|
||
// No profile: the unread micro population bluffs, so the floor still holds.
|
||
let spot = Spot { villains: vec![villain(None)], ..river(12.0, 6.0) };
|
||
assert!(defends(&spot, Made::MiddlePair));
|
||
}
|
||
|
||
#[test]
|
||
fn a_profile_without_an_aggression_read_is_defended_like_an_unread_one() {
|
||
// Live HUD with vpip only (replay 10.11., hand 174898200346): no bluff evidence either way,
|
||
// so the floor holds exactly as for an unread villain.
|
||
let vpip_only = Profile { vpip: Some(0.6), ..Profile::default() };
|
||
let spot = Spot { villains: vec![villain(Some(vpip_only))], ..river(12.0, 6.0) };
|
||
assert!(defends(&spot, Made::MiddlePair));
|
||
let thin = Profile { aggression: Some(0.0), aggression_confidence: Some(2.0 / 32.0), ..Profile::default() };
|
||
let spot = Spot { villains: vec![villain(Some(thin))], ..river(12.0, 6.0) };
|
||
assert!(defends(&spot, Made::MiddlePair), "two seen moves are no under-bluff evidence");
|
||
let nan = Profile { aggression: Some(f64::NAN), ..Profile::default() };
|
||
let spot = Spot { villains: vec![villain(Some(nan))], ..river(12.0, 6.0) };
|
||
assert!(defends(&spot, Made::MiddlePair));
|
||
}
|
||
|
||
#[test]
|
||
fn a_balanced_regular_is_not_floored() {
|
||
// The near-GTO opponent (reads.rs oracle p(0.32, 0.22, 0.42, 0.40)): moderate aggression 0.40
|
||
// < 0.45 -> no over-bluff evidence, so the model's fold is trusted and a bluff-catcher is NOT
|
||
// force-called (BEFUND-gto-ueberdefense: this is the −52 bb/100 river-call leak).
|
||
let gto = Profile { pfr: Some(0.22), ..prof(0.40, 0.32, 0.42) };
|
||
let spot = Spot { villains: vec![villain(Some(gto))], ..river(12.0, 6.0) };
|
||
assert!(!defends(&spot, Made::MiddlePair));
|
||
}
|
||
|
||
#[test]
|
||
fn a_wide_but_balanced_headsup_opponent_is_not_floored() {
|
||
// The regression this fix buys: the gto's realistic SESSION read, vpip 0.70 / pfr 0.46 /
|
||
// aggression 0.35 (measured heads-up, not the hand-set oracle). classify -> LooseAggressive on
|
||
// preflop WIDTH alone, which the old `over_bluffs` fired on and force-called into a balanced
|
||
// value range (BEFUND-gto-ueberdefense-read). Aggression 0.35 < 0.45 -> no over-bluff evidence,
|
||
// so the floor now stays off and trusts the model's fold.
|
||
let wide = Profile { pfr: Some(0.46), ..prof(0.35, 0.70, 0.50) };
|
||
use crate::exploit::style::{classify, Style};
|
||
assert_eq!(classify(&wide), Style::LooseAggressive);
|
||
let spot = Spot { villains: vec![villain(Some(wide))], ..river(12.0, 6.0) };
|
||
assert!(!defends(&spot, Made::MiddlePair));
|
||
}
|
||
|
||
#[test]
|
||
fn a_loose_aggressive_bettor_is_still_floored() {
|
||
// The maniac (reads.rs oracle p(0.76, 0.42, 0.50, 0.50); session read aggression ~0.49): its
|
||
// measured postflop aggression 0.50 >= 0.45 bets far more than a value range supports, so MDF
|
||
// defence against its bluffs is owed and the floor holds — on the direct aggression signal, not
|
||
// preflop width (which it shares with the balanced wide opponent above).
|
||
let maniac = Profile { pfr: Some(0.42), ..prof(0.50, 0.76, 0.50) };
|
||
let spot = Spot { villains: vec![villain(Some(maniac))], ..river(12.0, 6.0) };
|
||
assert!(defends(&spot, Made::MiddlePair));
|
||
}
|
||
|
||
#[test]
|
||
fn a_confirmed_under_bluffer_is_not_floored() {
|
||
// Low observed aggression (0.0) and a nit: no bluffs to catch, the fold stands.
|
||
let honest = Spot { villains: vec![villain(Some(prof(0.0, 0.25, 0.5)))], ..river(12.0, 6.0) };
|
||
assert!(!defends(&honest, Made::MiddlePair));
|
||
let nit = Spot { villains: vec![villain(Some(prof(0.15, 0.11, 0.8)))], ..river(12.0, 6.0) };
|
||
assert!(!defends(&nit, Made::MiddlePair));
|
||
}
|
||
|
||
#[test]
|
||
fn a_folded_under_bluffer_does_not_suppress_the_live_bettor() {
|
||
// The nit folded; the live bettor is unread -> still defended.
|
||
let nit = crate::game::Villain { folded: true, ..villain(Some(prof(0.15, 0.11, 0.8))) };
|
||
let spot = Spot { villains: vec![nit, villain(None)], ..river(12.0, 6.0) };
|
||
assert!(defends(&spot, Made::MiddlePair));
|
||
}
|
||
}
|