use super::called_equity::called_equity; use super::from_plan::{from_plan, MIN_CERTAINTY}; use super::passive::cheapest_continue; use super::postflop::choose_postflop_with; use super::range_combos::{as_ranges, combos}; use super::range_filter::{range_filter, HandFilter}; use crate::card::Card; use crate::equity::monte_carlo::estimate; use crate::equity::query::Query; use crate::equity::villain_range::VillainRange; use crate::exploit::adjust::adjust; use crate::exploit::profile::Profile; use crate::exploit::range_model::range_spec; use crate::exploit::thresholds::Thresholds; use crate::game::{Decision, Spot, Street}; use crate::guard::enforce::enforce; use crate::icm::lage::Turnierlage; use crate::icm::risk::{call_premium, jam_depth_gate, jam_pressure, jam_width_factor, width_factor}; use crate::preflop::advise::advise_widened; use crate::preflop::plan::PreflopPlan; use crate::read::hand_read::read; use crate::rng::Rng; const TRIALS_TWO_CARD: u32 = 3000; const TRIALS_OMAHA: u32 = 1500; fn trials(spot: &Spot) -> u32 { if spot.rules().hole_cards >= 4 { TRIALS_OMAHA } else { TRIALS_TWO_CARD } } /// Postflop: read the hand, model each villain's range, simulate against it and /// against the hands that would call each raise, choose. fn postflop(spot: &Spot, thresholds: &Thresholds, raw: &Spot, premium: f64) -> Decision { let rules = spot.rules(); let hand_read = match read(&rules, &spot.hero_cards, &spot.board) { Ok(r) => r, Err(fault) => return Decision::abstain(format!("hand read unavailable: {fault}")), }; let filters: Vec = spot .live_villains() .map(|v| range_filter(&range_spec(spot, v), rules, spot.variant, &spot.board)) .collect(); if filters.is_empty() { return cheapest_continue(spot).map_or_else( || Decision::abstain("no live opponent and nothing to continue with"), |choice| Decision::new(choice, 0.5, "no live opponents: cheapest continuing action"), ); } let dead: Vec = spot.hero_cards.iter().chain(&spot.board).copied().collect(); let lists: Vec<_> = filters.iter().map(|f| combos(&rules, f, &dead)).collect(); // Stage A river-subgame solver is NOT wired here. Proven exactly unexploitable (0.0 bb/100) vs a // correct GTO belief in `sim::exploit_river`, but with a SYMMETRIC prior it plays balanced poker // against players who must be exploited: wiring it live cost -43 bb/100 GESAMT, concentrated on // the calling station / fish / maniac (BEFUND-river-solver-balanced-vs-exploitable). It returns // to the live path only once the belief is opponent-aware (posterior -> range) and trust-gated // (crown: KL ball around GTO, lambda from read confidence). Until then the heuristic EV line below // keeps the exploit edge the whole ladder depends on. let ranges: Vec = as_ranges(&filters, &lists); let query = Query { rules, hero: &spot.hero_cards, board: &spot.board, villains: &ranges, trials: trials(spot), }; match estimate(&query, Rng::seeded(spot.seed)) { Ok((equity, _)) => { // GTO-Boden UEBER dem Modell, aber unter der Exploit-Range: ein modellgetriebener // River-Fold einer verteidigungswuerdigen Made-Hand wird zum MDF-Call. `raw` traegt die // UNGEGATETEN Reads - der Boden darf den Gegner-Bluffanteil defensiv lesen (gegen einen // bewiesenen Nicht-Bluffer mehr folden), was `read_gate` dem Range-Modell verwehrt. let base = choose_postflop_with(spot, &equity, &called_equity(spot), thresholds, &hand_read); let floored = crate::exploit::mdf_floor::floor(raw, hand_read.made, base).with_equity(equity.share); // Defensive river veto (the belief+trust gearbox, CASH ONLY): a confident read that the // villain UNDER-bluffs its river bet turns a heuristic call into a fold. This is the one // place the gearbox is a proven edge — the heuristic over-calls under-bluffed overbets // (nemesis-3); its OFFENSE (thin value, light calls vs real bluffers) stays untouched, // because replacing that with a KL-GTO line bled EV on the ladder. Never overrides an // ICM-driven line (premium > 0): chip-EV must not override a tournament fold/call. // // The TURN veto (`turn_subgame::turn_fold_veto`, Stage B) stays OUT of the live path. Two // measurements now agree it regresses the hardest value-heavy nemesis (nemesis-1, bluff // 0.068): pooled belief -7.77, per-street-aggression belief -25.93 (worse). The root is NOT // belief granularity — per-street aggression fixed nemesis-2 but made nemesis-1 worse. It is // the draw-BLIND turn bucket: the veto folds bluff-catchers whose river equity the // current-strength ladder undervalues, so a defensive turn fold forfeits realized equity the // river veto never does (the river is final). Fixing it needs draw-aware turn bucketing or // the offline/value-function form, not a live fold-veto. The turn solver + per-street belief // stay as tested primitives. See BEFUND-stage-b-turn-river-solver.md. if premium <= 0.0 { let after_river = super::river_subgame::fold_veto(raw, floored); return super::turn_subgame::turn_fold_veto(raw, after_river); } floored } Err(fault) => Decision::abstain(format!("equity unavailable: {fault}")), } } /// Thresholds with the tournament risk premium (`icm::risk`) added: calls need more equity, /// the preflop width narrows. No premium: unchanged. fn with_premium(thresholds: Thresholds, premium: f64) -> Thresholds { if premium <= 0.0 { return thresholds; } Thresholds { call_margin: thresholds.call_margin + premium, range_width_scale: thresholds.range_width_scale * width_factor(premium), ..thresholds } } fn think(spot: &Spot, premium: f64, jam_widen: f64, raw: &Spot) -> Decision { let profiles: Vec = spot.live_villains().filter_map(|v| v.profile).collect(); let thresholds = with_premium(adjust(Thresholds::BASE, &profiles), premium); match spot.street { Street::Preflop => { let plan = advise_widened(spot, &thresholds, jam_widen); // Eine Grenzhand folgt ihrer Seite der Tabelle (Raise bleibt Raise, Call bleibt Call): // nahe der Grenze ist jede Linie fast gleich viel wert, Aussetzen ist die schlechteste. let certainty = plan.certainty.max(MIN_CERTAINTY); from_plan(spot, &PreflopPlan { certainty, ..plan }) } Street::Flop | Street::Turn | Street::River => postflop(spot, &thresholds, raw, premium), } } /// Full decision for a validated spot (preflop chart or postflop read/equity/EV), /// always passed through `guard::enforce::enforce`. Die Handkategorie wird nur /// zur Nachprüfung angehängt. pub fn decide(spot: &Spot) -> Decision { decide_with(spot, None) } /// `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 raw = spot; // ungated reads, used ONLY by the defensive MDF floor (mdf_floor::floor) let spot = &gated; let premium = match lage.map(|l| call_premium(spot, l)) { None => 0.0, Some(Some(p)) => p, Some(None) => return Decision::abstain("tournament situation unusable: no money EV"), }; // Open-Jam-Weitung an der Bubble (`icm::risk::jam_pressure`): nur bei Turnierlage, sonst neutral. // Unpricebar -> 1.0 (keine Weitung), nie ein Abbruch - der Riegel liegt bei `premium`/Calls. // Tiefen-gegated (`jam_depth_gate`): die Weitung ist ein Kurzstack-Hebel; ein tiefer Deckler // weitet NICHT (sonst oeffnet er Muell aus der Tiefe - gemessen: cover-short -12.5 ICM$/100). let jam_widen = lage .and_then(|l| jam_pressure(spot, l)) .map(jam_width_factor) .map(|w| 1.0 + (w - 1.0) * jam_depth_gate(spot.hero_stack / spot.big_blind)) .unwrap_or(1.0); let decision = enforce(spot, think(spot, premium, jam_widen, raw)); match crate::hand::showdown::best(spot.rules().hole_usage, &spot.hero_cards, &spot.board) { Ok(strength) => decision.with_category(strength.category), Err(_) => decision, } }