diff --git a/docs/notizen/STAND-weltklasse.md b/docs/notizen/STAND-weltklasse.md index d981a050..8c984bb8 100644 --- a/docs/notizen/STAND-weltklasse.md +++ b/docs/notizen/STAND-weltklasse.md @@ -440,3 +440,4 @@ Zweig `claude/gedaechtnis-pokerintel` (Worktree gedaechtnis-voll), nicht im Live | Eingereiht (Zeile 4) | LBR gepaart 2000 blind + weitreg (`fs-lbr-*`, Frühstopp), dann Leiter all, micro, pool-nl2, Lerner (`fs-*-{aus,an}`, Arm-Binary `pokerbench-exploit-fortsetzung-tor.exe`) | – | | Schritt 2 vorbereitet | `LESE_VERTRAUEN=nit,reg,lag` (Teilmenge) öffnet `read_gate` je Stil, aus = bitgleich. Pilot alle drei auf FORTSETZUNG=1: Mittel +2,60 ±4,01, gemischt (nit +3,45, nemesis-3 +9,36, polar +54, nemesis-2 −9,61 ±12,39) – wird je Stil getrennt gemessen | 742e1c6 | | Schritt 4 vorbereitet | `nemesis [deals] [gens] [seed]`, Live-Schalter aus der Umgebung (`sim::arm_env`, aus ab_zelle gezogen, bitgleich geprüft), CMA-ES hält `POKERBENCH_THREADS` ein | eeb7a31 | +| REST_STACK gebaut (Auftrag Orchestrator, Live-Hand 178493100165, −97,5 BB) | Schalter `REST_STACK=1` in `size_policy::sizes`, aus = bitgleich. Ein Postflop-Raise, der gecallt weniger als `REST_STACK_SPR = 0,5` Pots hinter sich lässt (effektiver Stack), ist ein Stack-off: mit Strong-Stufe oder Anteil ≥ 0,75 ersetzt ihn das All-in, sonst fällt er weg (Call/Fold bleiben). Schwelle aus der Rechnung: gegen einen Shove des Rests r in den Pot p braucht der Call `r/(p + 2r)` Equity, bei r = 0,5 p genau 25 %, die jedes Paar und jeder Draw gegen Value hält. Die Live-Hand (1,12 von 1,94, Rest 0,82 in 2,70, SPR 0,30) liegt darin (Spec `engine_size_policy`). Befund dazu: das Raise-EV (`bluff::branches`) bewertet nur Fold + Call, den Re-Shove mit erzwungenem Call nie (der Check-Raise-Zweig `RAISE_MODEL` ist aus) – gehört als Erweiterung zu FORTSETZUNG. Tor eingereiht (`rs-*-an`, Basis `fs-*-aus`), läuft erst nach Spielende | – | diff --git a/src/engine/size_policy.rs b/src/engine/size_policy.rs index 2c98a0d5..2bd2c440 100644 --- a/src/engine/size_policy.rs +++ b/src/engine/size_policy.rs @@ -15,6 +15,7 @@ //! | pot control | medium hand: small band (as bluffs); deeper than 150 bb every value hand short of a monster: 45 to 60 % | //! | stack bands | up to 15 bb push/fold (preflop); 15 to 40 bb sizes times 0.85 and speculative calls cost 0.02 more; 40 to 150 bb standard; over 150 bb pot control | //! | thin stack-offs | a raise or call of 60 % of the stack or more needs a strong hand or a share of 0.75 (a call: 0.04 more margin for a medium hand) | +//! | no man's land (`REST_STACK=1`) | a raise that, called, leaves under 0.5 pot behind: all-in instead with a strong hand or share 0.75, else dropped | use super::bluff::RaiseKind; use crate::exploit::table_fold::pressure_ratio; @@ -166,5 +167,61 @@ pub fn sizes(spot: &Spot, kind: RaiseKind, share: f64, read: &HandRead) -> Vec= Tier::Strong || share >= THIN_STACK_OFF_SHARE_NEEDED; picked.retain(|to| strong || !is_stack_off(spot, *to)); + if rest_stack_on() { + picked = no_mans_land(spot, picked, strong); + } picked } + +/// Below this stack-to-pot ratio after a called raise the raiser is committed: against a shove of the +/// rest `r` into the pot `p` the call needs equity `r / (p + 2r)`, at `r = 0.5 p` exactly 25 %, which +/// any pair or draw holds against a value range. So such a raise is a stack-off in effect. +pub const REST_STACK_SPR: f64 = 0.5; + +/// Messschalter `REST_STACK=1` (einmal gelesen), Vorgabe aus (bitgleich). +fn rest_stack_on() -> bool { + use std::sync::OnceLock; + static ON: OnceLock = OnceLock::new(); + *ON.get_or_init(|| std::env::var("REST_STACK").as_deref() == Ok("1")) +} + +/// Stack behind after a raise to `to` is called (effective stack, so a raise that already covers the +/// villain leaves nothing), and the pot then. +fn rest_after(spot: &Spot, to: f64) -> (f64, f64) { + let eff = (effective_stack_bb(spot) * spot.big_blind).min(spot.hero_stack); + let pot = crate::odds::ev::final_pot(spot.pot, spot.to_call, to); + ((eff - to).max(0.0), pot) +} + +/// A raise in no man's land: if called, less than `REST_STACK_SPR` pots stay behind, but not nothing. +pub fn in_no_mans_land(spot: &Spot, to: f64) -> bool { + let (rest, pot) = rest_after(spot, to); + rest > 1e-9 && pot > 0.0 && rest < REST_STACK_SPR * pot +} + +/// Live hand 178493100165 (-97,5 BB): a re-raise to 58 % of the stack slipped under the stack-off +/// share, left ~0,5 pot behind, villain shoved, hero had to call. Such a size is a stack-off: with a +/// strong hand (or share >= 0.75) the all-in replaces it; otherwise it is dropped (call/fold remain). +fn no_mans_land(spot: &Spot, picked: Vec, strong: bool) -> Vec { + if !picked.iter().any(|to| in_no_mans_land(spot, *to)) { + return picked; + } + let shove = all_in_size(spot); + let mut out: Vec = picked.into_iter().filter(|to| !in_no_mans_land(spot, *to)).collect(); + if strong { + out.extend(shove); + } + out.sort_by(f64::total_cmp); + out.dedup(); + out +} + +/// The legal all-in raise-to: the upper bound without a size menu; with one, its largest size when +/// that puts the stack in. +fn all_in_size(spot: &Spot) -> Option { + let hi = crate::sizing::bounds::bounds(spot)?.hi; + match &spot.allowed_sizes { + None => (hi.is_finite() && hi >= spot.hero_stack - 1e-9).then_some(hi), + Some(_) => candidates(spot).last().copied().filter(|to| *to >= spot.hero_stack - 1e-9), + } +} diff --git a/tests/engine_size_policy.rs b/tests/engine_size_policy.rs index fbfe4257..3c3e55da 100644 --- a/tests/engine_size_policy.rs +++ b/tests/engine_size_policy.rs @@ -90,3 +90,25 @@ fn thin_hands_do_not_stack_off() { let picked = sizes(&spot, RaiseKind::Value, 0.64, &thin); assert!(!picked.contains(&15.0), "{picked:?}"); } + +/// Live hand 178493100165: hero re-raises to 1.12 of 1.94 over a raise to 0.36 (big blind 0.02). Called, +/// 0.82 stays behind in a pot of 2.70 (SPR 0.30 < 0.5): no man's land. The shove and a small raise are not. +#[test] +fn a_raise_that_leaves_under_half_a_pot_behind_is_no_mans_land() { + use rechner::engine::size_policy::in_no_mans_land; + let spot = Spot { + to_call: 0.24, + pot: 0.70, + hero_stack: 1.94, + min_raise_to: Some(0.48), + max_raise_to: Some(1.94), + allowed_sizes: None, + legal: vec![ActionKind::Fold, ActionKind::Call, ActionKind::Raise], + villains: vec![rechner::game::Villain { seat: 2, stack: 3.0, folded: false, profile: None }], + big_blind: 0.02, + ..round_flop() + }; + assert!(in_no_mans_land(&spot, 1.12)); + assert!(!in_no_mans_land(&spot, 1.94)); + assert!(!in_no_mans_land(&spot, 0.60)); +}