437 lines
25 KiB
Rust
437 lines
25 KiB
Rust
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_list, combo_list};
|
|
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::{Choice, Decision, SeenAction, Spot, Street};
|
|
use crate::guard::enforce::enforce;
|
|
use crate::icm::lage::Turnierlage;
|
|
use crate::icm::push_fold::push_fold;
|
|
use crate::icm::risk::{call_premium, jam_depth_gate, jam_pressure, jam_width_factor, width_factor};
|
|
use crate::preflop::advise::{advise_widened_read, scale_for};
|
|
use crate::preflop::certainty::certainty;
|
|
use crate::preflop::exploit_border::exploit_border;
|
|
use crate::preflop::hand_percentile::percentile;
|
|
use crate::preflop::plan::{ChartAction, PreflopPlan};
|
|
use crate::preflop::situation_of::situation_of;
|
|
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, lage: Option<&Turnierlage>) -> Decision {
|
|
let rules = spot.rules();
|
|
let hand_read = match read(&rules, &spot.hero_cards, &spot.board) {
|
|
Ok(r) if spot.to_call > 0.0 && matches!(crate::read::hand_read::brett_paar_mode(), 2 | 3) => {
|
|
crate::read::hand_read::board_pair_facing_bet(r, &spot.hero_cards, &spot.board)
|
|
}
|
|
Ok(r) => r,
|
|
Err(fault) => return Decision::abstain(format!("hand read unavailable: {fault}")),
|
|
};
|
|
let filters: Vec<HandFilter> = 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<Card> = spot.hero_cards.iter().chain(&spot.board).copied().collect();
|
|
let lists: Vec<_> = filters.iter().map(|f| combo_list(&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<VillainRange> = as_ranges_list(&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.
|
|
crate::exploit::fold_chance::set_ueberbet_hand(super::options::holds_one_pair(spot, &hand_read));
|
|
super::check_falle::merke_roh(raw);
|
|
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.clone()).with_equity(equity.share);
|
|
let floored = super::vermerk::ersetzt(&base, floored);
|
|
// 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 {
|
|
// Arm (off by default, RIVER_DBR): the data-biased robust counter-strategy plays the
|
|
// heads-up river whenever the read is strong enough (`river_subgame::dbr_decision`).
|
|
if let Some(d) = super::river_subgame::dbr_decision(raw) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
// Solver-Kern Stufe 1 (off by default, SOLVER_KERN=river): every heads-up cash river from a
|
|
// solve against the MEASURED NL2 opponent (BETTOR + pool fold curve node-locked, mixed with
|
|
// CFR), ranges from the line up to the turn (`engine::solver_kern`).
|
|
// Solver-Kern gegen All-in (off by default, SOLVER_KERN=…+allin=equity): turn or river facing an all-in
|
|
// that closes the betting: call iff the equity against the range reaches break-even after rake.
|
|
if let Some(d) = super::solver_kern::allin_decision(raw, equity.share) {
|
|
return super::vermerk::entschieden(d);
|
|
}
|
|
if let Some(d) = super::solver_kern::river_decision(raw) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
// Solver-Kern Stufe 2/3 (off by default, SOLVER_KERN=turn / flop): the heads-up cash turn from a
|
|
// turn+river solve, the flop from a flop+turn solve; the villain's first-street nodes locked to
|
|
// BETTOR and the pool fold curve of that street.
|
|
if let Some(d) = super::solver_kern::turn_decision(raw) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
// Stage A, solver everywhere (off by default, SOLVER_RIVER): the heads-up river decided
|
|
// by an equilibrium solve over real combos, ranges from the line (`engine::river_spieler`).
|
|
if let Some(d) = super::river_spieler::river_spieler_decision(raw) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
// Multiway river (off by default, SOLVER_RIVER3): 3- and 4-handed rivers decided by
|
|
// Monte-Carlo CFR over real combos (`engine::river3_spieler`).
|
|
if let Some(d) = super::river3_spieler::river3_decision(raw) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
// Arm (off by default, TURN_SPIEL=grund): the turn+river game with ranges from the
|
|
// blueprint (`engine::turn_game`); `None` while the switch is off. Stage B supersedes it
|
|
// when on (same game, blueprint ranges where recognised, hero's hand always kept, inside
|
|
// the turn deadline): E3 first would spend the deadline and then hand pruned hands to the
|
|
// heuristic.
|
|
// KERN_RUECKFALL: under the emergency brake the turn game (it knows no clock) does not start either.
|
|
let e3 = if super::turn_game::turn_ueberall() || super::rueckfall::bremst() { None } else { super::turn_game::turn_game_decision(raw) };
|
|
if let Some(d) = e3 {
|
|
if turn_fold_heuristik() && d.choice == Choice::Fold && floored.choice != Choice::Fold {
|
|
super::vermerk::notiere(format!("TURN_SPIEL_FOLD: Turnspiel wollte folden ({}) -> Heuristik bleibt", d.reason));
|
|
return floored;
|
|
}
|
|
return super::vermerk::ersetzt(&floored, super::vermerk::entschieden(d).with_equity(equity.share));
|
|
}
|
|
// Stage B, solver everywhere (off by default, SOLVER_TURN): every heads-up turn.
|
|
if let Some(d) = super::turn_game::turn_solver_decision(raw) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
// Multiway turn and flop (off by default, SOLVER_TURN3 / SOLVER_FLOP3): 3- and 4-handed
|
|
// spots decided by Monte-Carlo CFR over the remaining streets (`engine::multi3_spieler`).
|
|
if let Some(d) = super::multi3_spieler::multi3_decision(raw) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
// Stage C, solver everywhere (off by default, SOLVER_FLOP): every heads-up flop.
|
|
if let Some(d) = super::flop_spieler::flop_spieler_decision(raw) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
// Rückfall (off by default, KERN_RUECKFALL=baum): no solver path answered (time, emergency brake, minimum
|
|
// iterations, spot outside the slice): a tiny single-street solve answers instead of the rule of thumb.
|
|
if let Some(d) = super::rueckfall::entscheide(spot, &lists, lage) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
// FAUSTREGEL=aus (off by default): the rule of thumb is unreachable postflop; the fallback answers always.
|
|
if super::rueckfall::ohne_faustregel() {
|
|
if let Some(d) = super::rueckfall::entscheide_immer(spot, &lists, lage) {
|
|
return super::vermerk::entschieden(d).with_equity(equity.share);
|
|
}
|
|
}
|
|
// Bounded exploitation of the non-station reads (`read_exploit`, switch GEGNER_BREIT, off).
|
|
let vetoed = super::vermerk::ersetzt(&floored, super::river_subgame::fold_veto(raw, floored.clone()));
|
|
return super::read_exploit::postflop(raw, &hand_read, vetoed);
|
|
}
|
|
// Turnier mit Prämie (KERN_RUECKFALL=…,icm): kein Cash-Solver darf hier antworten (Chips statt Geld); der Rückfall
|
|
// bewertet den winzigen Baum in Geld (`rueckfall::Geld`). Ohne das Schalter-Wort bleibt es bei der Heuristik.
|
|
if lage.is_some() && super::rueckfall::icm_an() {
|
|
if let Some(d) = super::rueckfall::entscheide(spot, &lists, lage) {
|
|
return d.with_equity(equity.share);
|
|
}
|
|
if super::rueckfall::ohne_faustregel() {
|
|
if let Some(d) = super::rueckfall::entscheide_immer(spot, &lists, lage) {
|
|
return d.with_equity(equity.share);
|
|
}
|
|
}
|
|
}
|
|
floored
|
|
}
|
|
Err(fault) => Decision::abstain(format!("equity unavailable: {fault}")),
|
|
}
|
|
}
|
|
|
|
/// `TURN_SPIEL_FOLD=heuristik` (off = bit-identical): the E3 turn game (`TURN_SPIEL=grund`) may not
|
|
/// turn a heuristic call/raise into a fold; its raises, checks and sizes stay. Pruefstand 18.11.: the
|
|
/// grid's 81 premium-to-fold flips under TURN_SPIEL are E3 folds of top pair/overpair with equity far
|
|
/// above break-even (Ac7h 0.77 vs 0.21), real NL2 spots without TURN_SPIEL +460 bb holdout
|
|
/// (`messung/pruefstand/BERICHT.md`).
|
|
fn turn_fold_heuristik() -> bool {
|
|
use std::sync::OnceLock;
|
|
static AN: OnceLock<bool> = OnceLock::new();
|
|
*AN.get_or_init(|| std::env::var("TURN_SPIEL_FOLD").as_deref() == Ok("heuristik"))
|
|
}
|
|
|
|
/// 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
|
|
}
|
|
}
|
|
|
|
/// Tournament short stack (`icm::push_fold`): the jam/call-or-fold answer of the ICM push/fold
|
|
/// equilibrium, its border moved only by the EXPLOIT width (`scale_for` on the thresholds WITHOUT the
|
|
/// ICM premium - the premium is already inside the prize-money terminals, counting it twice would
|
|
/// over-tighten). `None` where the jam game does not model the spot: the chip chart path stays.
|
|
fn icm_push_fold_plan(spot: &Spot, lage: &Turnierlage, exploit: &Thresholds) -> Option<PreflopPlan> {
|
|
let answer = push_fold(spot, lage)?;
|
|
let hand = percentile(spot.variant, &spot.hero_cards);
|
|
let scale = scale_for(spot, situation_of(spot), exploit, None);
|
|
let (aggressive, verb) = if answer.facing_jam { (ChartAction::Call, "call") } else { (ChartAction::Jam, "jam") };
|
|
let equilibrium = if answer.continue_ { aggressive } else { ChartAction::Fold };
|
|
let action = exploit_border(equilibrium, aggressive, hand, answer.width, scale);
|
|
let said = if action == ChartAction::Fold { "fold" } else { verb };
|
|
let moved = if action == equilibrium { String::new() } else { format!(", exploit width {scale:.2} -> {said}") };
|
|
Some(PreflopPlan {
|
|
action,
|
|
percentile: hand,
|
|
certainty: certainty(hand, &[answer.width * scale]),
|
|
reason: format!(
|
|
"ICM push/fold {:.1}bb vs {} {}: {} (equilibrium {verb}s {:.0}%, ICM edge {:+.4}){moved}",
|
|
answer.depth_bb,
|
|
answer.callers,
|
|
if answer.callers == 1 { "caller" } else { "callers" },
|
|
if answer.continue_ { verb } else { "fold" },
|
|
100.0 * answer.width,
|
|
answer.edge,
|
|
),
|
|
})
|
|
}
|
|
|
|
/// Hero acts first in (no raise yet): the open-jam half of the push/fold game.
|
|
fn first_in(spot: &Spot) -> bool {
|
|
!spot.history.iter().any(|r| {
|
|
r.street == Street::Preflop && matches!(r.action, SeenAction::Raise | SeenAction::AllIn | SeenAction::Bet)
|
|
})
|
|
}
|
|
|
|
fn think(spot: &Spot, premium: f64, jam_widen: f64, raw: &Spot, lage: Option<&Turnierlage>) -> Decision {
|
|
let profiles: Vec<Profile> = spot.live_villains().filter_map(|v| v.profile).collect();
|
|
let exploit = adjust(Thresholds::BASE, &profiles);
|
|
let thresholds = with_premium(exploit, premium);
|
|
match spot.street {
|
|
Street::Preflop => {
|
|
// Bounded light 3-bet vs openers the gate plays blind (`read_exploit`, switch GEGNER_BREIT);
|
|
// cash only: with an ICM premium the raw read stays out.
|
|
let read = (premium <= 0.0).then_some(raw);
|
|
let chip = advise_widened_read(spot, read, &thresholds, jam_widen);
|
|
// First-in WEITET der Push/Fold-Solver den Chip-Plan nur (Fold -> Jam), er engt ihn nie ein:
|
|
// sein Gleichgewicht unterstellt einen Caller, der ICM-genau breit callt; ein echter Gegner
|
|
// callt nach Chip-Staerke enger (Leiter covered-reg: Solver-Fold statt Chip-Jam -9.1 +-7.0
|
|
// je 100). Eroeffnet der Chip-Pfad kleiner (Raise/Limp), bleibt sein reicheres Spiel. Gegen
|
|
// einen Jam (Call/Fold) gilt der Solver ganz: dort zaehlt das eigene Bust-Risiko.
|
|
let plan = match lage.and_then(|l| icm_push_fold_plan(spot, l, &exploit)) {
|
|
Some(icm) if first_in(spot) && !(icm.action == ChartAction::Jam && chip.action == ChartAction::Fold) => chip,
|
|
Some(icm) => icm,
|
|
None => chip,
|
|
};
|
|
// VORFLOP_POP=oeffnen,kalt (nur Cash): Fold-Veto fuer UTG/HJ-Opens und Kalt-Calls BTN/SB.
|
|
let plan = if lage.is_none() { crate::preflop::vorflop_pop::veto_oeffnen(spot, plan) } else { plan };
|
|
// VORFLOP_EINTRITT (nur Cash): Erstentscheidung nach der Range der echten NL2-Gewinner (Fold/Raise statt Call).
|
|
let plan = if lage.is_none() { crate::preflop::vorflop_eintritt::anwenden(spot, plan) } else { plan };
|
|
// VORFLOP_BREITE (nur Cash): BB v SB und BTN-Open nach der Solver-Range (messung/vorflop/bbdef/).
|
|
let plan = if lage.is_none() { crate::preflop::vorflop_breite::anwenden(spot, plan) } else { plan };
|
|
// 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 => stufe_b(raw, premium, postflop(spot, &thresholds, raw, premium, lage)),
|
|
}
|
|
}
|
|
|
|
/// `STUFE_B=1` (Nachpruefung 2, 23.11.; off = bit-identical): the Stage-B defensive turn veto
|
|
/// (`turn_subgame::turn_fold_veto`) on the FINAL heads-up cash turn decision, whichever path made it
|
|
/// (Solver-Kern, turn game or rule of thumb): a confident under-bluff read folds a turn call.
|
|
fn stufe_b(raw: &Spot, premium: f64, d: Decision) -> Decision {
|
|
static AN: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
|
if !*AN.get_or_init(|| std::env::var("STUFE_B").as_deref() == Ok("1")) {
|
|
return d;
|
|
}
|
|
if premium > 0.0 || raw.street != Street::Turn || raw.live_villains().count() != 1 || d.choice != Choice::Call {
|
|
return d;
|
|
}
|
|
let v = super::turn_subgame::turn_fold_veto(raw, d.clone());
|
|
if v.choice == d.choice { d } else { super::vermerk::ersetzt(&d, v) }
|
|
}
|
|
|
|
/// 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 {
|
|
// UEBERSCHUSS=1: a bet that covers hero prices only the part hero can match (`engine::ueberschuss`),
|
|
// trimmed once (the history still shows the whole bet).
|
|
match super::ueberschuss::trimmed(spot) {
|
|
Some(trimmed) => decide_matched(&trimmed, lage),
|
|
None => decide_matched(spot, lage),
|
|
}
|
|
}
|
|
|
|
/// `decide_with` on a spot whose pot holds only what hero can win.
|
|
fn decide_matched(spot: &Spot, lage: Option<&Turnierlage>) -> Decision {
|
|
let d = decide_matched_inner(spot, lage);
|
|
if crate::exploit::spaet_fold::schutz_greift(spot, &d) {
|
|
// SPAET_FOLD wertschutz: dieselbe Anfrage ohne die Ersetzung (eigene Merkstelle des Solvers); war sie ein Bet, bleibt er.
|
|
crate::exploit::spaet_fold::aussetzen(true);
|
|
let alt = decide_matched_inner(spot, lage);
|
|
crate::exploit::spaet_fold::aussetzen(false);
|
|
if matches!(alt.choice, crate::game::Choice::Raise { .. }) {
|
|
return crate::exploit::spaet_fold::schutz_notiz(alt);
|
|
}
|
|
}
|
|
d
|
|
}
|
|
|
|
fn decide_matched_inner(spot: &Spot, lage: Option<&Turnierlage>) -> Decision {
|
|
use crate::exploit::style::{set_station_postflop_override as force, station_demoted, station_narrow, station_postflop_override};
|
|
// WETT_KURVE: which of hero's bets in this decision the measured NL2 fold curve prices (none when off).
|
|
crate::exploit::wett_kurve::setze_lage(spot);
|
|
// STATION_POSTFLOP=schmal: against a villain the postflop gate would demote, decide with the
|
|
// station read and blind (demoted) and play the less aggressive action (`exploit::style`).
|
|
if station_narrow() && spot.live_villains().any(|v| v.profile.as_ref().is_some_and(station_demoted)) {
|
|
let before = station_postflop_override();
|
|
force(Some(0));
|
|
let station = decide_one(spot, lage);
|
|
force(Some(1));
|
|
let demoted = decide_one(spot, lage);
|
|
force(before);
|
|
return if aggression_rank(demoted.choice) < aggression_rank(station.choice) {
|
|
let note = format!(
|
|
"STATION_POSTFLOP schmal: mit Stations-Read {}, blind {} -> {}",
|
|
super::vermerk::aktion(&station.choice),
|
|
super::vermerk::aktion(&demoted.choice),
|
|
super::vermerk::aktion(&demoted.choice)
|
|
);
|
|
super::vermerk::anhaengen(demoted, &[note])
|
|
} else {
|
|
station
|
|
};
|
|
}
|
|
decide_one(spot, lage)
|
|
}
|
|
|
|
/// Fold < check/call < raise; abstain counts as the most aggressive (never preferred).
|
|
fn aggression_rank(c: Choice) -> u8 {
|
|
match c {
|
|
Choice::Fold => 0,
|
|
Choice::Check | Choice::Call => 1,
|
|
Choice::Raise { .. } => 2,
|
|
Choice::Abstain => 3,
|
|
}
|
|
}
|
|
|
|
/// One decision in its own vermerk frame: the notes of overriding rules are appended to the reason.
|
|
fn decide_one(spot: &Spot, lage: Option<&Turnierlage>) -> Decision {
|
|
super::vermerk::beginne();
|
|
crate::exploit::spaet_fold::rahmen_auf();
|
|
let d = super::vermerk::abschliessen(decide_one_inner(spot, lage));
|
|
crate::exploit::spaet_fold::rahmen_zu(d)
|
|
}
|
|
|
|
fn decide_one_inner(spot: &Spot, lage: Option<&Turnierlage>) -> Decision {
|
|
// RAKE_LIVE (`rake::live`, off by default): a cash spot prices every pot net of the room's rake;
|
|
// a tournament pays none, also a chip-linear one that plays the cash path below
|
|
// (the scope is decided on the original situation). Off: no scope, nothing changes.
|
|
let _rake = match lage {
|
|
None => crate::rake::live::cash_scope_seats(spot.big_blind, spot.seats),
|
|
Some(_) => crate::rake::live::enabled().then(crate::rake::live::Scope::none),
|
|
};
|
|
// Chip-lineares Geld (der Sieger nimmt alles, alle Verbliebenen gleich bezahlt, p1 > p2 = ... = pn):
|
|
// ICM IST Chip-EV, also genau der Cash-Pfad. Eine unbepreisbare Lage bleibt ein Aussetzen.
|
|
let lage = lage.filter(|l| !(l.is_usable() && l.is_chip_linear()));
|
|
super::frist::begin();
|
|
// 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);
|
|
crate::exploit::street_continuation::note_raw_reads(spot);
|
|
super::options::note_paar_raw(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, lage));
|
|
// DREIBET_TOPF=real (aus = unveraendert): knapper Flop-/Turn-Call im heads-up 3-Bet-Topf -> Fold, nur Cash.
|
|
let decision = if lage.is_none() { super::dreibet_topf::veto(spot, decision) } else { decision };
|
|
// DROSSEL (aus = bitgleich): MW-Lead mit Luft, MW-Zug-Raise gegen Einsatz, HU-Turn-Barrel mit Luft auf Gewinner-Haeufigkeit.
|
|
let decision = if lage.is_none() { super::drossel::drossel(spot, decision) } else { decision };
|
|
// Measurement only (GEGNER_BREIT_DIAG): why the reading layer left this decision blind.
|
|
let decision = if super::read_exploit::diag_on() {
|
|
let why = super::read_exploit::diagnose(raw, &decision, premium);
|
|
Decision { reason: format!("{} | {why}", decision.reason), ..decision }
|
|
} else {
|
|
decision
|
|
};
|
|
match crate::hand::showdown::best(spot.rules().hole_usage, &spot.hero_cards, &spot.board) {
|
|
Ok(strength) => decision.with_category(strength.category),
|
|
Err(_) => decision,
|
|
}
|
|
}
|