From f8e1035c5460f35a00fd3926de321c89a788171d Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Fri, 6 Nov 2026 19:08:18 +0100 Subject: [PATCH] Read-Riegel: nie schlechter als blind (nur klar Schwache ausbeuten) Leiter-Befund mit WAHREN Reads: gegen Reg/Nit/Maniac verstellt sich die Engine und verliert (Heads-up-Reg -102 bb/100), gegen Fish/Station crusht sie. read_gate behaelt den Read daher nur fuer die ausbeutungswuerdige Calling Station und faellt sonst aufs Blind-Spiel zurueck (Profil -> None in decide_with). Leiter gegen die ehrliche Basislinie: HU reg +128, nit +63, maniac +129, 6max reg +41 BESSER; Fish/Station unveraendert (Crush bleibt); GESAMT +36 bb/100 BESSER. engine_read_gate test-first gruen; keine Regression in from_plan/postflop/advise. --- src/engine/decide.rs | 4 ++ src/engine/mod.rs | 1 + src/engine/read_gate.rs | 34 +++++++++++++++ tests/engine_read_gate.rs | 89 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 src/engine/read_gate.rs create mode 100644 tests/engine_read_gate.rs diff --git a/src/engine/decide.rs b/src/engine/decide.rs index a0d957f4..be19d470 100644 --- a/src/engine/decide.rs +++ b/src/engine/decide.rs @@ -107,6 +107,10 @@ pub fn decide(spot: &Spot) -> Decision { /// `decide` with an optional tournament situation (`icm`). Without one: cash. With one /// that cannot be priced: ABSTAIN. pub fn decide_with(spot: &Spot, lage: Option<&Turnierlage>) -> Decision { + // Only act on reads we are proven to beat blind play with (`read_gate`); competent and + // aggressive opponents are played blind until the exploit logic earns them on the ladder. + let gated = super::read_gate::gate_reads(spot); + let spot = &gated; let premium = match lage.map(|l| call_premium(spot, l)) { None => 0.0, Some(Some(p)) => p, diff --git a/src/engine/mod.rs b/src/engine/mod.rs index 3e8dd968..557b4e13 100644 --- a/src/engine/mod.rs +++ b/src/engine/mod.rs @@ -11,6 +11,7 @@ pub mod multiway; pub mod options; pub mod passive; pub mod postflop; +pub mod read_gate; pub mod range_combos; pub mod range_filter; pub mod read_label; diff --git a/src/engine/read_gate.rs b/src/engine/read_gate.rs new file mode 100644 index 00000000..cf799cd2 --- /dev/null +++ b/src/engine/read_gate.rs @@ -0,0 +1,34 @@ +//! "Never worse than blind." Measured on the ladder, the exploit logic only beats solid blind play +//! against clearly-weak, over-calling opponents (calling stations / fish). Acting on a read of a +//! competent or aggressive opponent (reg / nit / maniac) makes the engine play WORSE than blind - it +//! bleeds to a heads-up reg (−102 bb/100 with a truthful read). Until the exploit logic earns the +//! right to adjust against them (proven on the ladder, fed by real strong-player data), the engine +//! keeps a read ONLY for the proven-profitable weak class and plays everyone else blind. +//! +//! This can never make a read harmful: it only ever acts where acting is known to help, and falls +//! back to the solid baseline everywhere else. Same spirit as the price/commitment floor - a read, +//! like a loose table, may never tip us into a worse decision. + +use crate::exploit::style::{classify, Style}; +use crate::game::{Spot, Villain}; + +/// A read is acted on only when it marks a clearly-weak, over-calling opponent - the one class the +/// exploit logic is measured to beat blind play against. Every other style falls back to blind. +pub fn exploit_worthy(style: Style) -> bool { + matches!(style, Style::CallingStation) +} + +/// The spot with every opponent read the engine is not (yet) proven to use profitably dropped to +/// `None`, so the decision plays blind against competent and aggressive opponents and only exploits +/// the weak. +pub fn gate_reads(spot: &Spot) -> Spot { + let villains = spot + .villains + .iter() + .map(|v| Villain { + profile: v.profile.filter(|p| exploit_worthy(classify(p))), + ..v.clone() + }) + .collect(); + Spot { villains, ..spot.clone() } +} diff --git a/tests/engine_read_gate.rs b/tests/engine_read_gate.rs new file mode 100644 index 00000000..dce91006 --- /dev/null +++ b/tests/engine_read_gate.rs @@ -0,0 +1,89 @@ +//! "Never worse than blind": der Read-Riegel. Gegen klar Schwache (Calling Station) wird der Read +//! behalten und ausgebeutet; gegen Kompetente/Aggressive (Reg/Nit/Maniac) faellt die Engine auf das +//! blinde Grundspiel zurueck (Profil -> None). Belegt an der Leiter: mit Read verliert sie dort, +//! blind nicht. + +use rechner::engine::read_gate::{exploit_worthy, gate_reads}; +use rechner::exploit::profile::Profile; +use rechner::exploit::style::Style; +use rechner::game::{ActionKind, Spot, Street, Villain}; +use rechner::variant::Variant; + +fn prof(vpip: f64, pfr: f64, fold: f64, aggr: f64) -> Option { + Some(Profile { vpip: Some(vpip), pfr: Some(pfr), fold_to_bet: Some(fold), aggression: Some(aggr) }) +} + +fn spot_mit(villains: Vec) -> Spot { + Spot { + variant: Variant::Nlhe, + big_blind: 1.0, + seats: (villains.len() as u8) + 1, + hero_seat: 0, + button_seat: Some(0), + hero_cards: vec![], + board: vec![], + street: Street::Flop, + pot: 10.0, + to_call: 0.0, + hero_stack: 100.0, + min_raise_to: Some(2.0), + max_raise_to: Some(100.0), + legal: vec![ActionKind::Check, ActionKind::Raise], + allowed_sizes: None, + villains, + seed: 1, + history: vec![], + } +} + +fn villain(seat: u8, profile: Option) -> Villain { + Villain { seat, stack: 100.0, folded: false, profile } +} + +#[test] +fn nur_die_calling_station_ist_ausbeutungswuerdig() { + assert!(exploit_worthy(Style::CallingStation)); + assert!(!exploit_worthy(Style::Regular)); + assert!(!exploit_worthy(Style::Nit)); + assert!(!exploit_worthy(Style::LooseAggressive)); + assert!(!exploit_worthy(Style::Unknown)); +} + +#[test] +fn der_read_eines_regs_wird_fallen_gelassen() { + // Reg (0.26/0.19/0.50/0.50) -> Regular -> blind: Profil weg. + let gespielt = gate_reads(&spot_mit(vec![villain(1, prof(0.26, 0.19, 0.50, 0.50))])); + assert_eq!(gespielt.villains[0].profile, None); +} + +#[test] +fn der_read_einer_calling_station_bleibt() { + // Station (0.80/0.0/0.05/0.05) -> CallingStation -> Read behalten. + let roh = prof(0.80, 0.0, 0.05, 0.05); + let gespielt = gate_reads(&spot_mit(vec![villain(1, roh)])); + assert_eq!(gespielt.villains[0].profile, roh); +} + +#[test] +fn gemischter_tisch_nur_die_schwachen_reads_bleiben() { + let station = prof(0.80, 0.0, 0.05, 0.05); + let reg = prof(0.26, 0.19, 0.50, 0.50); + let gespielt = gate_reads(&spot_mit(vec![ + villain(1, station), + villain(2, reg), + villain(3, None), + ])); + assert_eq!(gespielt.villains[0].profile, station, "Station bleibt"); + assert_eq!(gespielt.villains[1].profile, None, "Reg wird blind"); + assert_eq!(gespielt.villains[2].profile, None, "ohne Read bleibt ohne"); +} + +#[test] +fn der_rest_des_spots_bleibt_unberuehrt() { + let s = spot_mit(vec![villain(1, prof(0.26, 0.19, 0.50, 0.50))]); + let g = gate_reads(&s); + assert_eq!(g.pot, s.pot); + assert_eq!(g.villains.len(), s.villains.len()); + assert_eq!(g.villains[0].seat, 1); + assert_eq!(g.villains[0].stack, 100.0); +}