Files
pokerfreak/src/engine/from_plan.rs
T
mmintelandClaude Opus 5.5 031c550014 Pruefstand: Vetos in der Begruendung, POSTERIOR auf echten Spots, Kandidaten fluss/ENTHALTUNG, Werkzeuge tor_echt + kippliste
- vermerk.rs: jede Regel, die eine Aktion nach der Grundrechnung ueberstimmt, haengt sich an reason;
  bitgleich auf 48 672 Anfragen (0 Abweichungen ausser reason)
- POSTERIOR=...,fluss (S2 nur am River): echte NL2-Spots holdout +53 276 bb eq; Tor wegen Pflichtfall offen
- ENTHALTUNG=passiv: gehaltener Raise im Fehler -> beste passive Linie statt ABSTAIN (Laeufer foldete +EV-Calls)
- livefaelle: Kommawerte (POSTERIOR=bluff,schutz,beleg) wurden abgeschnitten
- Alle neuen Schalter aus = Live-Stand bitgleich; nichts live geschaltet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:00:02 +01:00

81 lines
3.5 KiB
Rust

use super::passive::{cheapest_continue, give_up};
use crate::game::{ActionKind, Choice, Decision, Spot};
use crate::preflop::commit_guard::{raise_commitment, RaiseVerdict};
use crate::preflop::plan::{ChartAction, PreflopPlan};
use crate::sizing::{all_in::all_in, preflop::raise_size};
/// Below this chart certainty, a plan that would put chips in is not trusted.
pub const MIN_CERTAINTY: f64 = 0.15;
fn aggressive(spot: &Spot, size: Option<f64>) -> Option<Choice> {
spot.is_legal(ActionKind::Raise)
.then_some(size)
.flatten()
.map(|to| Choice::Raise { to })
.or_else(|| cheapest_continue(spot))
.or_else(|| give_up(spot))
}
fn wanted(spot: &Spot, action: ChartAction) -> Option<Choice> {
match action {
ChartAction::Jam => aggressive(spot, all_in(spot)),
ChartAction::Raise => aggressive(spot, raise_size(spot)),
ChartAction::Call => cheapest_continue(spot).or_else(|| give_up(spot)),
ChartAction::Fold => give_up(spot),
}
}
/// Maps a chart action through sizing and legality.
/// Jam is all-in, Raise the standard preflop size (both fall back to calling when a
/// raise is impossible), Call calls or checks when free, Fold folds or checks when
/// free. A certainty under [`MIN_CERTAINTY`] turns chip-committing plans into ABSTAIN.
/// A charted `Raise` that sizing capped to (near) all-in is a commitment: it must clear the same
/// price cut-off as a jam, or it steps down to a call (price paid) / fold (commit_guard). A `Raise`
/// well below all-in, and every non-Raise plan, pass through unchanged (the Jam already passed the
/// jam ceiling in `preflop::advise`).
fn commit_begrenzt(spot: &Spot, plan: &PreflopPlan, choice: Option<Choice>) -> Option<Choice> {
match choice {
Some(Choice::Raise { to }) if plan.action == ChartAction::Raise => {
let jam = all_in(spot).unwrap_or(to);
let out = match raise_commitment(plan.percentile, to, jam, spot.to_call, spot.pot) {
RaiseVerdict::Keep => Some(Choice::Raise { to }),
RaiseVerdict::Downgrade => cheapest_continue(spot).or_else(|| give_up(spot)),
RaiseVerdict::Fold => give_up(spot),
};
match out {
Some(Choice::Raise { .. }) => {
if crate::preflop::vorflop_pop::ziel(spot).is_some() {
super::vermerk::notiere(format!("VORFLOP_POP: Groesse nach NL2-Population, raise to {to:.2}"));
}
}
Some(c) => super::vermerk::notiere(format!(
"Commit-Riegel: raise to {to:.2} bindet den Stack -> {}",
super::vermerk::aktion(&c)
)),
None => {}
}
out
}
other => other,
}
}
pub fn from_plan(spot: &Spot, plan: &PreflopPlan) -> Decision {
match commit_begrenzt(spot, plan, wanted(spot, plan.action)) {
None => Decision::abstain(format!("{}: no legal way to follow the chart", plan.reason)),
Some(choice @ (Choice::Call | Choice::Raise { .. })) if plan.certainty < MIN_CERTAINTY => {
Decision::abstain(format!(
"{}: certainty {:.2} too low to {}",
plan.reason,
plan.certainty,
choice.name().to_lowercase()
))
}
Some(choice) => Decision::new(
choice,
plan.certainty,
format!("{} -> {}", plan.reason, choice.name().to_lowercase()),
),
}
}