Files
pokerfreak/src/engine/double_board.rs
T
mmintel fdef28234e Doppelbrett: Call/Fold auf Split-Equity statt besserem Brett
Bei zwei Brettern wird der Pot haelftig je Brett vergeben; Heros echter
Anteil ist das Mittel beider Brett-Equities. decide_double entschied bisher
nach dem besseren Brett (optimistisch) und beging so einen Uebercall, wenn
eine Hand nur auf EINEM Brett stark war. Jetzt gatet die Split-Equity den
Call: liegt das Mittel unter dem Preis (odds::break_even), wird gefoldet;
schlaegt es den Preis, traegt das bessere Brett die Aktion wie bisher.

PLO5-Messlatte: der Ueberbet-Fallen-Spot (Nut-Flush Brett1, tot Brett2,
Split 50,3%% < Preis 61,5%%) kippt von CALL (-2,93 bb) auf FOLD (0); Summe
186,40 -> 189,33 bb; Monster-Doppelbretter unveraendert. NLHE-Leiter gleich
(+0.00). Mutant 0.5->5 getoetet.
2026-11-07 09:01:42 +01:00

77 lines
3.5 KiB
Rust

use super::decide::decide;
use crate::card::Card;
use crate::game::{ActionKind, Choice, Decision, Spot};
use crate::guard::validate::check;
use crate::odds::break_even::break_even;
/// Double board (`boardDouble`): the same spot is decided once per board.
///
/// **The pot is split between the boards**, so hero's real pot share is the *mean* of both
/// board equities, not the better one. The call/fold decision is gated on that split share:
/// when the mean clears the price (`odds::break_even`), the better board carries the
/// continuing action and its reasoning is reported; when the mean falls short, the hand
/// folds - a hand that is strong on one board only no longer overcalls the whole pot.
/// Both boards are judged independently (the opponent's range is not required to be one
/// hand on both boards).
///
/// Anything unclear is refused instead of guessed: a second board of another length,
/// a card twice, or a board that cannot be judged gives `ABSTAIN`.
pub fn decide_double(spot: &Spot, second: &[Card]) -> Decision {
if second.len() != spot.board.len() {
return Decision::abstain(format!(
"invalid request: boardDouble has {} cards, board has {}",
second.len(),
spot.board.len()
));
}
if let Some(card) = second.iter().find(|c| spot.hero_cards.contains(c) || spot.board.contains(c)) {
return Decision::abstain(format!("invalid request: boardDouble repeats {card:?}"));
}
let other = match check(Spot { board: second.to_vec(), ..spot.clone() }) {
Ok(other) => other,
Err(fault) => return Decision::abstain(format!("invalid request: boardDouble: {fault}")),
};
let first = decide(spot);
let second = decide(&other);
if first.choice == Choice::Abstain || second.choice == Choice::Abstain {
return Decision::abstain(format!(
"double board: a board cannot be judged ({} / {})",
first.reason, second.reason
));
}
// Pott geteilt: Heros echter Anteil ist das Mittel beider Brett-Equities. Schlaegt das
// Mittel den Preis nicht, waere das Mitgehen am besseren Brett ein Uebercall -> Fold.
if let (Some(a), Some(b)) = (first.equity, second.equity) {
let mean = 0.5 * (a + b);
let price = break_even(spot.pot, spot.to_call);
if mean < price && spot.is_legal(ActionKind::Fold) {
let (chosen, number) = if b > a { (&second, 2) } else { (&first, 1) };
return Decision {
choice: Choice::Fold,
reason: format!(
"double board: split equity {mean:.2} below price {price:.2} (board 1 {a:.2}, \
board 2 {b:.2}); pot split halves each board, board {number} strong alone is \
not enough - {}",
chosen.reason
),
equity: Some(mean),
..chosen.clone()
};
}
}
let (chosen, number, other_equity) = match (first.equity, second.equity) {
(Some(a), Some(b)) if b > a => (second, 2, Some(a)),
(_, b) => (first, 1, b),
};
let compared = match (chosen.equity, other_equity) {
(Some(a), Some(b)) => format!(" (equity {a:.2} against {b:.2})"),
_ => String::new(),
};
let reason = format!(
"double board: board {number} judged better{compared}; approximation: better board \
although the pot split halves it - {}",
chosen.reason
);
Decision { reason, ..chosen }
}