diff --git a/benchmarks/plo5_baseline.txt b/benchmarks/plo5_baseline.txt index d2cad87c..798da112 100644 --- a/benchmarks/plo5_baseline.txt +++ b/benchmarks/plo5_baseline.txt @@ -1,4 +1,4 @@ -label ed79423e+lokal +label ddbd2937+lokal scenario monster deals 5 seed 104372000587777 @@ -7,8 +7,8 @@ samples 9.771833333333333 10 7.0425 9.094916666666666 10 scenario marginal deals 5 seed 104372000587777 -counts 5 0 0 -samples 7.1335 3.4498291666666674 6.981533333333333 9.33625 -3.7799166666666664 +counts 4 1 1 +samples 7.1335 3.4498291666666674 6.981533333333333 9.33625 0 scenario trash deals 5 seed 104372000587777 diff --git a/src/engine/postflop.rs b/src/engine/postflop.rs index 40202288..b55a24ae 100644 --- a/src/engine/postflop.rs +++ b/src/engine/postflop.rs @@ -10,6 +10,7 @@ use crate::exploit::thresholds::Thresholds; use crate::game::{ActionKind, Choice, Decision, Spot}; use crate::odds::{break_even::break_even, ev}; use crate::read::hand_read::HandRead; +use crate::read::nut_made::nuss_lage; fn label(choice: Choice, kind: Option) -> String { match (choice, kind) { @@ -87,6 +88,32 @@ pub fn choose_postflop( choose_postflop_with(spot, estimate, &Called::flat(estimate.share), thresholds, read) } +/// Omaha-Nuss-Abschlag: ab vier Lochkarten heisst "weit von der Nuss auf einem gemachten Brett", +/// dass eine Setz-Range des Gegners die Hand oft schon schlaegt - die rohe Equity (gegen eine grobe +/// Range) ueberschaetzt dann die realisierte. Naehe zur Nuss (Rang 0/1) bleibt voll; mit Abstand +/// sinkt der realisierte Anteil, bis eine geschlagene Hand richtig foldet statt zu callen (Owner +/// 7.11.). NLHE (zwei Lochkarten) bleibt voellig unberuehrt (`read/nut_made`). +fn nut_abschlag(spot: &Spot, mut eff: Effective) -> Effective { + let rules = spot.rules(); + if rules.hole_cards < 4 || spot.board.len() < 3 { + return eff; + } + if let Some(lage) = nuss_lage(&rules, &spot.hero_cards, &spot.board) { + eff.share *= nut_faktor(lage.rang); + } + eff +} + +/// Daempfungsfaktor nach Abstand zur Nuss (Rang 0 = Nuss). Monoton, voll bei Nuss/Second Nut. +fn nut_faktor(rang: usize) -> f64 { + match rang { + 0 | 1 => 1.0, + 2..=4 => 0.88, + 5..=9 => 0.70, + _ => 0.35, + } +} + /// The rule for a postflop spot, given an equity estimate, the share against the /// calling range per raise size (`called`) and the hand read. /// @@ -112,7 +139,7 @@ pub fn choose_postflop_with( if !(raw.is_finite() && (0.0..=1.0).contains(&raw)) { return Decision::abstain("equity unavailable"); } - let eff = effective(spot, raw, thresholds, read); + let eff = nut_abschlag(spot, effective(spot, raw, thresholds, read)); let share = eff.share; let be = break_even(spot.pot, spot.to_call); let breakpoint = be + eff.call_margin; @@ -174,3 +201,20 @@ pub fn choose_postflop_with( }, }) } + +#[cfg(test)] +mod tests { + use super::nut_faktor; + + #[test] + fn nut_faktor_voll_bei_nuss_dann_monoton_fallend() { + // Nuss und Second Nut bleiben voll - sonst foldet man gute Haende weg. + assert_eq!(nut_faktor(0), 1.0); + assert_eq!(nut_faktor(1), 1.0); + // Mit Abstand zur Nuss sinkt der Faktor, nie unter Null (kein Totalausschluss). + assert!(nut_faktor(3) < 1.0); + assert!(nut_faktor(7) <= nut_faktor(3)); + assert!(nut_faktor(20) <= nut_faktor(7)); + assert!(nut_faktor(20) > 0.0); + } +}