diff --git a/docs/notizen/BEFUND-read-gate-earned-trust.md b/docs/notizen/BEFUND-read-gate-earned-trust.md new file mode 100644 index 00000000..ce54cebe --- /dev/null +++ b/docs/notizen/BEFUND-read-gate-earned-trust.md @@ -0,0 +1,40 @@ +# Befund: der Read-Riegel als Earned-Trust-Tabelle (Stage 3) + +## Frage +Der Riegel (`engine::read_gate`) liess bisher nur die Calling Station durch und spielte jeden +anderen Stil blind. War das zu vorsichtig? Welche Stile haben ihren Read auf der Leiter verdient? + +## Messung +Earned-Trust-Tabelle gebaut (`earned_trust: Style -> f64`), der Riegel ist jetzt `> 0.0` statt ein +fester Fall. Im Experiment jeder Nicht-Ueberzahler auf volle 1.0 gesetzt und die Leiter gegen die +blinde Basislinie (`benchmarks/baseline.txt`, df915b1) gefahren: + +| Szenario | Read gegen blind | Urteil | +|--------------------|-----------------:|-------------------| +| heads-up reg | −176.02 | SCHLECHTER | +| heads-up maniac | −147.57 | SCHLECHTER | +| heads-up nit | −50.44 | SCHLECHTER | +| 6-max reg | −61.79 | SCHLECHTER | +| 6-max nit | −22.39 | nicht unterscheidbar | +| 6-max maniac | +72.54 | nicht unterscheidbar | + +Der Nit macht aus einem blinden +37.73-Gewinner einen Verlierer. Kein starker Stil wird irgendwo +sauber BESSER. + +## Wurzel +Den Profil-Read eines starken Spielers zu behalten laesst das Range-Modell seine Continue-Range +ueberschaetzen -> die Engine hoert auf zu barrelen und verliert ihre Fold-Equity. Der DEFENSIVE +Wert eines starken Reads (duenne Value nicht in einen bewiesenen Nicht-Bluffer zahlen) wird ohnehin +schon vom ungegateten MDF-Boden geerntet (`mdf_floor::floor` auf dem rohen Spot in `engine::decide`). +Der Riegel steuert nur die OFFENSIVEN Anpassungen, und die zahlen sich allein gegen Ueberzahler aus. + +## Schluss +Die Tabelle bleibt beim Ueberzahler (1.0), alle anderen 0.0 — verhalten identisch zur alten +`matches!(CallingStation)`, aber jetzt datengetrieben und je Stil mit Messung belegt. Der konservative +Riegel ist nicht bloss vorsichtig, sondern gemessen richtig. + +## Naechster Schritt +Ein SICHERER offensiver Read gegen starke Spieler: nicht das ganze Profil ins Range-Modell geben, +sondern nur die Teile, die die Leiter als +EV beweist (z. B. Steal-Frequenz gegen den Nit, der 82 % +zu Bets foldet, ohne die Continue-Range zu ueberschaetzen). Dann verdient sich der Nit seinen Platz +in der Tabelle mit einem Wert > 0. diff --git a/src/engine/read_gate.rs b/src/engine/read_gate.rs index cf799cd2..3363f853 100644 --- a/src/engine/read_gate.rs +++ b/src/engine/read_gate.rs @@ -1,26 +1,59 @@ //! "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. +//! against opponents whose read it has EARNED. Acting on a read of a competent or aggressive +//! opponent (reg / maniac) makes the engine play WORSE than blind - it bleeds to a heads-up reg +//! (−102 bb/100 with a truthful read). Until a style's read is proven on the ladder (fed by real +//! data), the engine keeps a read ONLY for the earned styles 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. +//! The gate is a per-style table (`earned_trust`), not a single hard-coded class: each style is +//! turned on only once its `... (blind)` twin in `sim::benchmark` proves the read never costs. 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. +/// How much of a read's adjustment each opponent style has EARNED on the ladder — the measured right +/// to deviate from blind play. `1.0` = exploit in full, `0.0` = keep playing blind (the read is +/// dropped at the gate). This generalizes the old CallingStation-only gate into a per-style table, +/// so a style is turned on only once its read is proven never worse than blind (the `... (blind)` +/// twins in `sim::benchmark` / `benchmarks/baseline.txt`). +/// +/// Only `> 0.0` is consumed today (keep-or-drop at the gate); the shift shapes themselves live in +/// `exploit::style_shift` and apply in full to whatever survives the gate. The value is an `f64`, +/// not a bool, to leave room for a partial, confidence-weighted trust later without changing this +/// seam. +pub fn earned_trust(style: Style) -> f64 { + match style { + // Over-callers (fish, station): value-bet thinner, never bluff. Earned since Stage 0 — the + // `heads-up ... (blind)` twins show a large recaptured prize. + Style::CallingStation => 1.0, + // Measured on the ladder (Stage 3, every non-station style run at full trust against the + // blind baseline): acting on a strong-player read only ever COSTS. Heads-up, a truthful read + // is worse than blind by reg −176, maniac −148, nit −50 bb/100 — the nit turns a +38 blind + // winner into a loser. Keeping the profile makes the range model over-rate the opponent's + // continuing range, so the engine stops barrelling and loses its fold equity. The DEFENSIVE + // value of such a read (fold less thin value into a proven non-bluffer) is already harvested + // by the ungated MDF floor (`mdf_floor::floor` on the raw spot in `engine::decide`); this + // gate governs only the OFFENSIVE adjustments, which pay off solely against over-callers. So + // every non-over-caller stays blind until a safe offensive strong-read is built. + Style::Regular => 0.0, + Style::Nit => 0.0, + Style::LooseAggressive => 0.0, + // No usable read. + Style::Unknown => 0.0, + } +} + +/// A read is acted on only when its style has earned trust on the ladder - the classes 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) + earned_trust(style) > 0.0 } /// 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. +/// the earned styles. pub fn gate_reads(spot: &Spot) -> Spot { let villains = spot .villains diff --git a/tests/engine_read_gate.rs b/tests/engine_read_gate.rs index 220a2fb0..140a2eab 100644 --- a/tests/engine_read_gate.rs +++ b/tests/engine_read_gate.rs @@ -3,7 +3,7 @@ //! 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::engine::read_gate::{earned_trust, exploit_worthy, gate_reads}; use rechner::exploit::profile::Profile; use rechner::exploit::style::Style; use rechner::game::{ActionKind, Spot, Street, Villain}; @@ -49,6 +49,21 @@ fn nur_die_calling_station_ist_ausbeutungswuerdig() { assert!(!exploit_worthy(Style::Unknown)); } +#[test] +fn die_earned_trust_tabelle_treibt_den_riegel() { + // Stage 3: der Riegel ist eine Stil-Tabelle, kein fester Fall. Nur der Ueberzahler ist auf der + // Leiter bewiesen (1.0); jeder starke Stil kostete im Experiment und bleibt blind (0.0). Der + // Riegel ist genau "earned_trust > 0". + assert_eq!(earned_trust(Style::CallingStation), 1.0); + assert_eq!(earned_trust(Style::Regular), 0.0); + assert_eq!(earned_trust(Style::Nit), 0.0); + assert_eq!(earned_trust(Style::LooseAggressive), 0.0); + assert_eq!(earned_trust(Style::Unknown), 0.0); + for style in [Style::CallingStation, Style::Regular, Style::Nit, Style::LooseAggressive, Style::Unknown] { + assert_eq!(exploit_worthy(style), earned_trust(style) > 0.0, "{style:?}"); + } +} + #[test] fn der_read_eines_regs_wird_fallen_gelassen() { // Reg (0.26/0.19/0.50/0.50) -> Regular -> blind: Profil weg.