- boardDouble (Form wie board): je Board entschieden, die bessere Bewertung (höhere Equity) gewinnt; Näherung offen dokumentiert (Topf geteilt, exakt wäre der Mittelwert). Ungleiche Länge, doppelte Karte -> ABSTAIN - ritOffered -> rit (ACCEPT/DECLINE/ABSTAIN) und ritReason: annehmen über dem Bruchpunkt, ohne offenen Call fairer Anteil, ohne Equity ABSTAIN - keine bestehenden Felder oder Typen geändert; Zusatzfelder werden nach der Spot-Prüfung gelesen - Tests: benannte Referenzwerte, ein Board verbessert/das andere nicht, pipeline_extras_neutral zeigt bitgleiche Antworten ohne die Felder (779) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.6 KiB
Rust
42 lines
1.6 KiB
Rust
use crate::game::{Choice, Decision, Spot};
|
|
use crate::odds::break_even::break_even;
|
|
|
|
/// Answer to a run-it-twice offer (`ritOffered`).
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub enum RunTwice {
|
|
Accept,
|
|
Decline,
|
|
Abstain,
|
|
}
|
|
|
|
impl RunTwice {
|
|
pub fn name(self) -> &'static str {
|
|
match self {
|
|
RunTwice::Accept => "ACCEPT",
|
|
RunTwice::Decline => "DECLINE",
|
|
RunTwice::Abstain => "ABSTAIN",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Accept when the equity lies above the break-even point - the win is halved, but so is
|
|
/// the risk; otherwise decline. Break-even is `toCall / (pot + toCall)`; with nothing left
|
|
/// to call (already all in) it is the fair share `1 / players in the pot`. Without an
|
|
/// equity estimate (preflop, ABSTAIN) there is nothing to compare: `ABSTAIN`.
|
|
pub fn run_twice(spot: &Spot, decision: &Decision) -> (RunTwice, String) {
|
|
let Some(equity) = decision.equity.filter(|_| decision.choice != Choice::Abstain) else {
|
|
return (RunTwice::Abstain, "no equity estimate for this spot".to_string());
|
|
};
|
|
let (point, name) = if spot.to_call > 0.0 {
|
|
(break_even(spot.pot, spot.to_call), "break-even")
|
|
} else {
|
|
(1.0 / (1 + spot.live_villains().count()) as f64, "break-even (fair share)")
|
|
};
|
|
let answer = if equity > point { RunTwice::Accept } else { RunTwice::Decline };
|
|
let verdict = match answer {
|
|
RunTwice::Accept => "above: half the win, half the risk",
|
|
_ => "not above: decline",
|
|
};
|
|
(answer, format!("equity {equity:.2} against {name} {point:.2}, {verdict}"))
|
|
}
|