- BRETT_PAAR=groesse: wie raise, dazu am River ohne Einsatz hoechstens Pot, wenn das "two pair" nur ein eigenes Paar plus Brett-Paar ist. fj5 gegen Live: Leiter +0,38, Micro +0,59, Lerner +0,53 Gewinner, 6-max -0,23 +-0,62, LBR +0,03, kein Verlierer. fj4 (Kappe auch am Turn) verlor im 6-max am Turn, daher nur River. CALLED_JAM=nicht_station verliert an der Station (Micro -6,79), bleibt aus. - ALLIN_TIEFE=1: call_cutoff hoechstens 5/(Shove in bb), Boden 3,5 %, auch im Preis-Riegel (commit_guard::price_guarded_deep). A9o gegen 129 bb foldet. Tor: 6-max +0,99 +-1,25, sonst identisch. - Lib-Tests: 2 lerner-Tests scheitern nur im Parallel-Lauf, ebenso auf dem sauberen HEAD (vorbestehend). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
88 lines
4.5 KiB
Rust
88 lines
4.5 KiB
Rust
//! Price guard over the charted action. The heuristic chart row is solved for standard bet sizes;
|
|
//! facing a large, non-standard raise it misprices (Vorfall 6.11.: a medium hand jammed the stack
|
|
//! into a big 4-bet, and hands were folded while getting the price). This re-prices the ACTUAL call
|
|
//! against the pot, reusing the all-in call cut-off (`allin_call_cutoff`), so no new poker math.
|
|
|
|
use super::allin_call_cutoff::call_cutoff;
|
|
use super::plan::ChartAction;
|
|
|
|
/// A raise that reaches this fraction of the all-in size is a de-facto jam (leaves almost nothing).
|
|
const NEAR_ALLIN: f64 = 0.9;
|
|
|
|
/// What to do with a charted `Raise` once it has been sized.
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
pub enum RaiseVerdict {
|
|
/// Keep the raise as sized.
|
|
Keep,
|
|
/// The sized raise over-commits without the hand to back it - just pay the price (call).
|
|
Downgrade,
|
|
/// Not committable and not even getting the price - fold.
|
|
Fold,
|
|
}
|
|
|
|
/// A re-raise sized to (near) all-in commits the stack and must clear the same price cut-off as a
|
|
/// jam (Vorfall 6.11.: a 3x re-raise of a big 4-bet got capped to a near-all-in "raise" with 99 -
|
|
/// the action stayed `Raise`, so the jam ceiling never saw it). A raise well below all-in, or no
|
|
/// price to weigh, is kept untouched - normal 3-bets are never downgraded.
|
|
pub fn raise_commitment(percentile: f64, raise_to: f64, all_in: f64, to_call: f64, pot: f64) -> RaiseVerdict {
|
|
let priced = all_in.is_finite() && all_in > 0.0 && raise_to >= NEAR_ALLIN * all_in
|
|
&& to_call.is_finite() && pot.is_finite() && to_call > 0.0;
|
|
if !priced {
|
|
return RaiseVerdict::Keep;
|
|
}
|
|
if percentile <= call_cutoff(raise_to, pot) {
|
|
RaiseVerdict::Keep
|
|
} else if percentile <= call_cutoff(to_call, pot) {
|
|
RaiseVerdict::Downgrade
|
|
} else {
|
|
RaiseVerdict::Fold
|
|
}
|
|
}
|
|
|
|
/// Re-price `action` for the real price. `percentile` is the hand (smaller = better);
|
|
/// `to_call`/`pot` the immediate price; `commit` the chips at risk (hero's remaining stack);
|
|
/// `allow_call` is false in jam-or-fold games, where continuing means jamming, not calling.
|
|
///
|
|
/// `call_cutoff` is ALL-IN math: it prices a call that closes the action, with no streets left to
|
|
/// bleed a dominated hand. So the fold floor only fires when the call is itself (near) all-in
|
|
/// (`to_call >= NEAR_ALLIN * commit`) - the "danach fold" incident (6.11.): the last bit into a
|
|
/// huge pot is never folded. A cheaper call still has streets to come; there the chart decides, not
|
|
/// raw pot odds.
|
|
///
|
|
/// * Fold floor: an all-in-level call the hand is priced for (`percentile <= call_cutoff(to_call,
|
|
/// pot)`) is never folded - it continues (call, or jam in a jam-or-fold game).
|
|
/// * Jam ceiling: a jam is kept only when the hand clears the cut-off for committing `commit`
|
|
/// (`call_cutoff(commit, pot)`); otherwise it steps down to a call when calling is allowed and the
|
|
/// immediate price is paid, else a fold. Never commit the stack with a hand the price denies.
|
|
///
|
|
/// Not facing a bet (`to_call <= 0`) or non-finite input: unchanged.
|
|
pub fn price_guarded(action: ChartAction, percentile: f64, to_call: f64, pot: f64, commit: f64, allow_call: bool) -> ChartAction {
|
|
price_guarded_deep(action, percentile, to_call, pot, commit, allow_call, 0.0)
|
|
}
|
|
|
|
/// `price_guarded` whose fold floor uses the shove-depth cap (`ALLIN_TIEFE`, `call_cutoff_deep`) at
|
|
/// big blind `big_blind`; with the switch off (or `big_blind <= 0`) exactly `price_guarded`. Without
|
|
/// it the floor re-priced a depth-capped fold back to a call on the price alone.
|
|
pub fn price_guarded_deep(action: ChartAction, percentile: f64, to_call: f64, pot: f64, commit: f64, allow_call: bool, big_blind: f64) -> ChartAction {
|
|
if !(to_call.is_finite() && pot.is_finite()) || to_call <= 0.0 {
|
|
return action;
|
|
}
|
|
let stake = if commit.is_finite() && commit > 0.0 { commit } else { to_call };
|
|
let all_in_call = to_call >= NEAR_ALLIN * stake;
|
|
let pays_price = percentile <= super::allin_call_cutoff::call_cutoff_deep(to_call, pot, big_blind);
|
|
let continue_ = if allow_call { ChartAction::Call } else { ChartAction::Jam };
|
|
match action {
|
|
ChartAction::Fold if all_in_call && pays_price => continue_,
|
|
ChartAction::Jam => {
|
|
if percentile <= call_cutoff(stake, pot) {
|
|
ChartAction::Jam
|
|
} else if allow_call && pays_price {
|
|
ChartAction::Call
|
|
} else {
|
|
ChartAction::Fold
|
|
}
|
|
}
|
|
other => other,
|
|
}
|
|
}
|