PLO5-Messlatte breiter: 45 Spots ueber 6 Brett-Texturen, Basislinie +178.37 bb

Statt 15 River-Call/Fold-Spots jetzt 45, systematisch nach Brett-Textur:
trocken, gefaehrlich (Strassen-lastig), monoton (Flush), gepaart (Voll-Haus),
turn (Turn-All-in-Call, MC wuerfelt den River) und doppelbrett (Bomb-Pot,
Pot haelftig je Brett, Wahrheit = Mittel beider Equities). Je Textur Monster,
Marginals nahe der Nuss und geschlagene Fallen, Preise an der Call-Grenze.

Tiefe-MC-Wahrheit mit festem Seed je Spot (80k Laeufe), reproduzierbar
(zweimal gleiche Summe), Laufzeit rund 9 s.

Aufgedeckte Leaks: die breitere Latte zeigt systematische UEBERFOLDS starker
Nicht-Nuss-Haende (Nuss-Abschlag ueberkorrigiert) - u.a. Q-hoch-Flush bei 88 %
Equity gefoldet, Ueberpaare/Sets bei ~54 % gefoldet. Die Doppelbrett-Falle
(Nut-Flush Brett 1, tot Brett 2) deckt den -EV-Uebercall der Besser-Brett-
Optimik auf: -2.93 bb, der einzige negative Posten der Summe.
This commit is contained in:
2026-11-07 01:24:57 +01:00
parent 04a2255477
commit ea2dbb1f5c
2 changed files with 150 additions and 57 deletions
+28 -13
View File
@@ -1,16 +1,31 @@
label ddbd2937+lokal
scenario monster
label 04a22554+lokal
scenario trocken
deals 8
seed 104372000587777
counts 8 0 0
samples 7.0817499999999995 10 7.067250000000001 0 0 0 0 0
scenario gefaehrlich
deals 8
seed 104372000587777
counts 8 0 0
samples 9.1065 9.089624999999998 9.094750000000001 7.5435 6.8069749999999996 0 0 0
scenario monoton
deals 8
seed 104372000587777
counts 8 0 0
samples 10 10 10 0 0 0 0 0
scenario gepaart
deals 8
seed 104372000587777
counts 8 0 0
samples 10 7.624500000000001 9.777999999999999 0 0 0 0 0
scenario turn
deals 8
seed 104372000587777
counts 8 0 0
samples 9.692250000000001 8.904250000000001 5.177750000000001 7.7566375 0 0 0 0
scenario doppelbrett
deals 5
seed 104372000587777
counts 5 0 0
samples 9.771833333333333 10 7.0425 9.094916666666666 10
scenario marginal
deals 5
seed 104372000587777
counts 4 1 1
samples 7.1335 3.4498291666666674 6.981533333333333 9.33625 0
scenario trash
deals 5
seed 104372000587777
counts 5 0 0
samples 0 0 0 0 0
samples 9.886 9.010000000000002 7.681625 -2.9283374999999996 0
+122 -44
View File
@@ -2,12 +2,12 @@
//!
//! Die NLHE-Leiter (`src/bin/benchmark.rs`) spielt ganze Haende im Selbstspiel. Fuer PLO5 gibt es
//! dafuer noch keinen Gegner-Simulator. Diese Messlatte misst stattdessen einen eng umrissenen,
//! aber ehrlichen Teil der Staerke: die River-Entscheidung Call/Fold ueber einen festen Satz
//! Referenz-Spots (fuenf Lochkarten, fertiges Brett).
//! aber ehrlichen Teil der Staerke: die Call/Fold-Entscheidung ueber einen festen, nach
//! BRETT-TEXTUR sortierten Satz Referenz-Spots (fuenf Lochkarten, fertiges oder Turn-Brett).
//!
//! WIE gemessen wird:
//! 1. Fuer jeden Spot liefert eine TIEFE Monte-Carlo-Equity (`equity::monte_carlo`, 120k Laeufe,
//! fester Seed) die Wahrheit E = Hero-Anteil gegen zufaellige Gegnerhaende.
//! fester Seed je Spot) die Wahrheit E = Hero-Anteil gegen zufaellige Gegnerhaende.
//! 2. Die Engine (`wire::respond`) bekommt genau diesen Spot und waehlt CALL oder FOLD.
//! 3. Der Spot-Wert ist der Chip-EV der gewaehlten Aktion am Showdown, in Big Blinds:
//! CALL -> E * (Pot + ToCall) - ToCall FOLD -> 0
@@ -15,14 +15,26 @@
//! 4. Zwei Laeufe werden Spot fuer Spot gepaart verglichen (`sim::paired`), Verdikt
//! BESSER / SCHLECHTER / gleich -- wie die NLHE-Leiter.
//!
//! BRETT-TEXTUREN (je Textur Monster, echte Marginals nahe der Nuss und geschlagene Fallen):
//! trocken - unkoordiniert, kein Flush/Strasse/Paar: Sets und Ueberpaare fuehren klar.
//! gefaehrlich - verbundene, Strassen-lastige Bretter: Nuss-Strasse vs. zweitbeste Falle.
//! monoton - drei+ gleiche Farbe: Nut-Flush vs. kleiner Flush vs. nackte Made-Hand.
//! gepaart - Paar-/Trips-Brett: Volles Haus vs. Set in Voll-Haus-Gefahr.
//! turn - Turn-All-in-Call (4er-Brett, MC wuerfelt River): Equity-Treue eine Strasse frueher.
//! doppelbrett - PLO5-Bomb-Pot mit zwei Brettern, Pot haelftig je Brett. Wahrheit = Mittel
//! beider Equities (gesplitteter Pot); die Engine entscheidet nach dem besseren
//! Brett (optimistisch) -- genau hier wird ein moeglicher Leak sichtbar.
//!
//! ```text
//! cargo run --release --bin benchmark_plo5 # gegen benchmarks/plo5_baseline.txt
//! cargo run --release --bin benchmark_plo5 -- --save # aktuelle Engine wird zur Basislinie
//! ```
//!
//! Grenzen (bewusst eng): nur River, nur Call/Fold, Wahrheit gegen ZUFALLS-Gegner (nicht gegen
//! geschaetzte Ranges). Misst also Equity-Treue der River-Calls, nicht Bet-Sizing, Bluffs oder
//! fruehe Strassen. Der systematische Zufalls-Bias hebt sich im gepaarten Unterschied weitgehend auf.
//! Grenzen (bewusst eng): nur Call/Fold, Wahrheit gegen ZUFALLS-Gegner (nicht gegen geschaetzte
//! Ranges). Misst Equity-Treue der Calls, nicht Bet-Sizing, Bluffs oder fruehe Strassen. Der
//! systematische Zufalls-Bias hebt sich im gepaarten Unterschied weitgehend auf. Beim Doppelbrett
//! werden beide Brett-Equities einzeln (je 10 tote Karten) gewuerfelt; das vernachlaessigt die
//! Kreuz-Blocker des jeweils anderen Bretts -- ein kleiner, dokumentierter Modellfehler.
use rechner::card::Card;
use rechner::equity::monte_carlo::estimate;
@@ -38,58 +50,114 @@ use std::time::Instant;
use std::{env, fs, thread};
const BASELINE: &str = "benchmarks/plo5_baseline.txt";
const REF_TRIALS: u32 = 120_000;
const REF_TRIALS: u32 = 80_000;
const REF_SEED: u64 = 0x5EED_0005_0001;
const ENGINE_SEED: u64 = 0x5EED_0005_ABCD;
const STACK_BB: f64 = 1000.0;
/// Ein Referenz-Spot: Hero haelt fuenf Karten, das Brett ist komplett (River), Hero muss `to_call`
/// Ein Referenz-Spot: Hero haelt fuenf Karten, das Brett ist komplett (River, 5 Karten) oder ein
/// Turn (4 Karten); `board2` ist bei Doppelbrett das zweite Brett (sonst leer). Hero muss `to_call`
/// in einen Pot von `pot` (beides in Big Blinds) zahlen, gegen `villains` lebende Gegner.
struct RefSpot {
scenario: &'static str,
hero: &'static str,
board: &'static str,
board2: &'static str,
villains: usize,
pot: f64,
to_call: f64,
}
const fn spot(scenario: &'static str, hero: &'static str, board: &'static str, villains: usize, pot: f64, to_call: f64) -> RefSpot {
RefSpot { scenario, hero, board, villains, pot, to_call }
RefSpot { scenario, hero, board, board2: "", villains, pot, to_call }
}
/// Fester Satz Spots. Monster sollen callen, Muell soll folden, dazwischen liegt die Kante.
const SPOTS: [RefSpot; 15] = [
// Monster (heads-up, Pot-Bet): starke Made-Hands, Call ist klar +EV.
spot("monster", "As Ah Ks Kh 2c", "Ac Kd 7s 7d 2h", 1, 10.0, 10.0), // Asse voll
spot("monster", "Ah Kh 2c 3d 4s", "9h 5h 3h Ts 2d", 1, 10.0, 10.0), // Nut-Flush
spot("monster", "Qs Qh 2c 3d 4s", "Qd 9h 5s 7c 2h", 1, 10.0, 10.0), // Top-Set
spot("monster", "Th 9h Ad Ks Qc", "8c 7d 6s 2h Jd", 1, 10.0, 10.0), // Strasse
spot("monster", "Js Jh 2c 3d 4s", "Jd Jc 9h 5s 2h", 1, 10.0, 10.0), // Quads
// Marginal (heads-up, Halb- bis Pot-Bet): echte Kantenentscheidungen um die Preisgrenze.
spot("marginal", "As 5h 2c 3d 4s", "Ad 9h 5c 7d 2s", 1, 10.0, 5.0), // zwei Paar Asse/Fuenfen
spot("marginal", "Ks Qh 2c 3d 4s", "Kd 9h 5c 7d 2s", 1, 10.0, 7.0), // Top-Paar Koenige
spot("marginal", "Th Td 2c 3d 4s", "Ah 9h 5c 7d 2s", 1, 10.0, 6.0), // Unterpaar
spot("marginal", "9s 8h 2c 3d 4s", "7d 6h 5c Ad Ks", 1, 10.0, 5.0), // Strasse auf Angstbrett
spot("marginal", "As Ah 2c 3d 4s", "9h 8s 7c 6d 5h", 1, 10.0, 7.0), // Ueberpaar auf Strassenbrett
// Muell (drei Gegner, Pot-Bet): breite Niederlage, Fold ist klar richtig.
spot("trash", "6c 7d 8h Tc Qs", "As Kd 9h 4c 2s", 3, 12.0, 10.0),
spot("trash", "2s 3s 4h 6h 8d", "Ac Kd Qh Js 9c", 3, 12.0, 10.0),
spot("trash", "7s 6h 2c 3d 4h", "As Ad Kh Qc Jd", 3, 12.0, 10.0),
spot("trash", "9c 8d 2h 3s 4c", "Ah Ad Kh Qd Jc", 3, 12.0, 10.0),
spot("trash", "Ts 9d 2c 3h 4s", "Ac Kc Qc 5d 2h", 3, 12.0, 10.0), // moegliches Gegner-Flush-Brett
const fn dbl(scenario: &'static str, hero: &'static str, board: &'static str, board2: &'static str, villains: usize, pot: f64, to_call: f64) -> RefSpot {
RefSpot { scenario, hero, board, board2, villains, pot, to_call }
}
/// Fester Satz Spots, nach Brett-Textur gruppiert. Monster sollen callen, Fallen sollen folden,
/// dazwischen liegt die Kante. Preise so gesetzt, dass Marginals nahe der Call-Grenze liegen.
const SPOTS: [RefSpot; 45] = [
// --- trocken: unkoordiniert, kein Flush/Strasse/Paar ---
spot("trocken", "Ks Kh 2c 3d 4s", "Kd 8s 3h Jc 7h", 1, 10.0, 10.0), // Set Koenige
spot("trocken", "As Ah 7c 8d Tc", "Ad 9s 6h Js 2h", 1, 10.0, 10.0), // Set Asse
spot("trocken", "Qd Qs 7c 8d Tc", "Qh 9s 6d 2c 4h", 1, 10.0, 10.0), // Set Damen
spot("trocken", "As Ks 7d 8c Th", "Ac 9h 6d Jc 2s", 1, 10.0, 6.0), // Top-Paar Asse
spot("trocken", "Ks Qd 7h 8c 2s", "Kc 9s 6h Jd 3c", 1, 10.0, 6.0), // Top-Paar Koenige
spot("trocken", "Js Jh 2c 3d 4s", "Ac Kd 9c 7h 5s", 1, 10.0, 6.0), // Unterpaar JJ
spot("trocken", "Qd Jc 5h 6s 7d", "Ac Ks 9h 4c 2d", 3, 12.0, 10.0), // nur Ass-hoch
spot("trocken", "8s 8h 2c 3d 4s", "Ad Kc Qh Ts 5d", 3, 12.0, 10.0), // Unterpaar 88
// --- gefaehrlich: verbundene, Strassen-lastige Bretter ---
spot("gefaehrlich", "Ac Kd 5h 6s 7c", "Qh Js Td 3c 2h", 1, 10.0, 10.0), // Broadway-Nuss
spot("gefaehrlich", "Qc Jd 5h 6s 7c", "Th 9s 8d Kc 4h", 1, 10.0, 10.0), // Q-hoch Nuss-Strasse
spot("gefaehrlich", "Kd Qc 5h 6s 7d", "Js Td 9h 4c 2s", 1, 10.0, 10.0), // K-hoch Nuss-Strasse
spot("gefaehrlich", "Jd 8c 5h 2s 3d", "Th 9s 7d Kc 4h", 1, 10.0, 7.0), // J-hoch, nicht Nuss
spot("gefaehrlich", "8d 7c 5h 2s 3d", "Th 9s 6d Kc 4h", 1, 10.0, 7.0), // Endstrasse-Falle
spot("gefaehrlich", "Ah Ad 5h 2s 3d", "Th 9s 8d 7c 4h", 1, 10.0, 7.0), // Ueberpaar auf Strasse
spot("gefaehrlich", "Kd Kc 5h 2s 3d", "Qh Js Td 9c 8h", 3, 12.0, 10.0), // Set in Strassenbrett
spot("gefaehrlich", "6c 5d 2h 3s 4c", "Th 9s 8d Ac Kh", 3, 12.0, 10.0), // tote Verbinder
// --- monoton: drei+ gleiche Farbe ---
spot("monoton", "Ah Kh 2c 3d 4s", "9h 5h 3h Ts 2d", 1, 10.0, 10.0), // Nut-Flush
spot("monoton", "Ah Th 2c 3d 4s", "Kh 8h 5h Js 2d", 1, 10.0, 10.0), // zweitbester Flush
spot("monoton", "Kh Qh 2c 3d 4s", "Ah 8h 5h Js 2d", 1, 10.0, 7.0), // K-hoch Flush unter Ass
spot("monoton", "Qh Jh 2c 3d 4s", "Th 8h 5h Ks 2d", 1, 10.0, 7.0), // mittlerer Flush
spot("monoton", "As Ac 7d 8h Tc", "Kh 8s 5h 2h Jd", 1, 10.0, 6.0), // Ueberpaar, Flush moeglich
spot("monoton", "9h 8h 2c 3d 4s", "Ah Kh 5h Ts 2d", 3, 12.0, 10.0), // kleiner Flush, Falle
spot("monoton", "Ts 9d 2c 3h 4s", "Ac Kc Qc 5d 2h", 3, 12.0, 10.0), // kein Flush, Brett monoton
spot("monoton", "Jd Tc 2h 3s 4d", "Ah 9h 5h Ks Qd", 3, 12.0, 10.0), // nackte Strasse auf Flush
// --- gepaart: Paar-/Trips-Brett, Voll-Haus-Gefahr ---
spot("gepaart", "Js Jh 2c 3d 4s", "Jd Jc 9h 5s 2h", 1, 10.0, 10.0), // Quads
spot("gepaart", "9s 9h 2c 3d 4s", "9d Kc Kd 7h 2s", 1, 10.0, 10.0), // Volles Haus 9 ueber K
spot("gepaart", "As Ah 2c 3d 4s", "Ad 8c 8d 5h 2s", 1, 10.0, 10.0), // Volles Haus Asse
spot("gepaart", "Ks Kh 2c 3d 4s", "7d 7c 9h 5s 2h", 1, 10.0, 7.0), // Ueberpaar auf Paarbrett
spot("gepaart", "Qd Qc 5h 6s 7d", "8d 8c Ah 4c 2d", 1, 10.0, 7.0), // zweites Paar unter Ass
spot("gepaart", "Ts Td 5h 6s 7d", "Kd Kc 9h 4c 2d", 1, 10.0, 6.0), // Unterpaar auf Koenig-Paar
spot("gepaart", "6s 6d 2c 3h 4s", "Jd Jc 8h 5s 2d", 3, 12.0, 10.0), // Kleinpaar auf Paarbrett
spot("gepaart", "Qs Jd 2c 3h 4s", "Td Tc 9h 5s 2d", 3, 12.0, 10.0), // tote Strasse auf Trips-Gefahr
// --- turn: Turn-All-in-Call, 4er-Brett, MC wuerfelt den River ---
spot("turn", "As Ah Ks Kh 2c", "Ac Kd 7s 7d", 1, 10.0, 10.0), // Asse voll am Turn
spot("turn", "Ah Kh 2c 3d 4s", "9h 5h 3h Ts", 1, 10.0, 10.0), // Nut-Flush am Turn
spot("turn", "Qs Qh 2c 3d 4s", "Qd 9h 5s 7c", 1, 10.0, 10.0), // Top-Set am Turn
spot("turn", "Ts 9h Ad Ks Qc", "8c 7d 6s 2h", 1, 10.0, 7.0), // Strasse + Redraw am Turn
spot("turn", "Ks Qh 2c 3d 4s", "Kd 9h 5c 7d", 1, 10.0, 6.0), // Top-Paar am Turn
spot("turn", "Th Td 2c 3d 4s", "Ah 9s 5c 7d", 1, 10.0, 6.0), // Unterpaar am Turn
spot("turn", "9c 8d 2h 3s 4c", "Ah Ad Kh Qd", 3, 12.0, 10.0), // Luft am Turn, multiway
spot("turn", "7s 6h 2c 3d 4h", "As Ad Kh Qc", 3, 12.0, 10.0), // Luft am Turn, multiway
// --- doppelbrett: PLO5-Bomb-Pot, zwei Bretter, Pot haelftig je Brett ---
dbl("doppelbrett", "As Ah Ks Kh 2c", "Ac Kd 7s 7d 2h", "Ad 9c 6h Jd 3s", 1, 10.0, 10.0), // beide Bretter stark
dbl("doppelbrett", "Ah Kh Qs Jd Tc", "9h 5h 3h 2s 4d", "Qh Jc Td Ks 2c", 1, 10.0, 10.0), // Flush + Strasse
dbl("doppelbrett", "As Ac Kd Qh Js", "Ad 9h 6s 2c 3d", "7h 7c 7s 5d 2h", 1, 10.0, 7.0), // Set Asse / Voll-Haus beide Bretter
dbl("doppelbrett", "Ah Kh Qh Jd Tc", "9h 5h 2h 3s 4c", "8d 7c 6s 5s 4h", 1, 10.0, 16.0), // Nut-Flush Brett1, tot Brett2: Ueberbet-Falle
dbl("doppelbrett", "Ks Qd Jc Th 9s", "2c 3d 4h 5s 7c", "8d 8c 8h Kd Qc", 3, 12.0, 10.0), // beidseits schwach
];
/// Hero-Anteil am Pot gegen `villains` zufaellige Gegner, tief ausgewuerfelt: die Wahrheit.
fn reference_equity(index: usize, s: &RefSpot) -> f64 {
let hero = Card::parse_list(s.hero).expect("hero cards");
let board = Card::parse_list(s.board).expect("board cards");
let ranges: Vec<VillainRange> = (0..s.villains).map(|_| VillainRange::Any).collect();
let query = Query { rules: rules(Variant::Plo5), hero: &hero, board: &board, villains: &ranges, trials: REF_TRIALS };
let seed = REF_SEED.wrapping_add(index as u64 * 0x9E37_79B9_7F4A_7C15);
/// Brett-Karten eines Strings; Turn (4) oder River (5) ergibt sich aus der Laenge.
fn board_cards(text: &str) -> Vec<Card> {
Card::parse_list(text).expect("board cards")
}
/// Hero-Anteil am Pot gegen `villains` zufaellige Gegner, tief ausgewuerfelt, auf einem Brett.
fn board_equity(index: usize, salt: u64, hero: &[Card], board: &[Card], villains: usize) -> f64 {
let ranges: Vec<VillainRange> = (0..villains).map(|_| VillainRange::Any).collect();
let query = Query { rules: rules(Variant::Plo5), hero, board, villains: &ranges, trials: REF_TRIALS };
let seed = REF_SEED.wrapping_add(index as u64 * 0x9E37_79B9_7F4A_7C15).wrapping_add(salt);
estimate(&query, Rng::seeded(seed)).expect("reference spot must be a valid query").0.share
}
/// Die Wahrheit: Einzelbrett = Hero-Anteil; Doppelbrett = Mittel beider Brett-Anteile (Pot split).
fn reference_equity(index: usize, s: &RefSpot) -> f64 {
let hero = board_cards(s.hero);
let board = board_cards(s.board);
let first = board_equity(index, 0, &hero, &board, s.villains);
if s.board2.is_empty() {
return first;
}
let board2 = board_cards(s.board2);
let second = board_equity(index, 0xA5A5, &hero, &board2, s.villains);
0.5 * (first + second)
}
fn card_json(c: Card) -> String {
format!(r#"{{"rank":"{}","suit":"{}"}}"#, c.rank.name(), c.suit.name())
}
@@ -98,18 +166,28 @@ fn cards_json(cards: &[Card]) -> String {
format!("[{}]", cards.iter().map(|c| card_json(*c)).collect::<Vec<_>>().join(","))
}
/// Brett als `{"FLOP":..,"TURN":..,"RIVER":..}`; River ist beim Turn-Spot `null`.
fn board_json(board: &[Card]) -> String {
let river = if board.len() >= 5 { cards_json(&board[4..5]) } else { "null".to_string() };
format!(r#"{{"FLOP":{},"TURN":{},"RIVER":{}}}"#, cards_json(&board[0..3]), cards_json(&board[3..4]), river)
}
fn request(s: &RefSpot) -> String {
let hero = Card::parse_list(s.hero).expect("hero cards");
let board = Card::parse_list(s.board).expect("board cards");
let hero = board_cards(s.hero);
let board = board_cards(s.board);
let street = if board.len() >= 5 { "RIVER" } else { "TURN" };
let villains: Vec<String> = (0..s.villains)
.map(|i| format!(r#"{{"seat":{},"stack":{STACK_BB},"folded":false}}"#, i + 1))
.collect();
let double = if s.board2.is_empty() {
String::new()
} else {
format!(r#","boardDouble":{}"#, board_json(&board_cards(s.board2)))
};
format!(
r#"{{"variant":"PLO5","bigBlind":1.0,"seats":6,"heroSeat":6,"buttonSeat":1,"heroCards":{},"board":{{"FLOP":{},"TURN":{},"RIVER":{}}},"street":"RIVER","pot":{},"toCall":{},"heroStack":{STACK_BB},"legalActions":["FOLD","CALL"],"seed":{ENGINE_SEED},"villains":[{}]}}"#,
r#"{{"variant":"PLO5","bigBlind":1.0,"seats":6,"heroSeat":6,"buttonSeat":1,"heroCards":{},"board":{},"street":"{street}","pot":{},"toCall":{},"heroStack":{STACK_BB},"legalActions":["FOLD","CALL"],"seed":{ENGINE_SEED},"villains":[{}]{double}}}"#,
cards_json(&hero),
cards_json(&board[0..3]),
cards_json(&board[3..4]),
cards_json(&board[4..5]),
board_json(&board),
s.pot,
s.to_call,
villains.join(","),
@@ -165,7 +243,7 @@ fn run_all(label: &str) -> (Run, Vec<Played>) {
run.deals += 1;
if p.action == "ABSTAIN" {
run.abstains += 1;
run.invalid += 1; // Aussetzen auf einem gueltigen River-Spot ist ein Defekt.
run.invalid += 1; // Aussetzen auf einem gueltigen Spot ist ein Defekt.
} else {
run.decisions += 1;
}
@@ -194,7 +272,7 @@ fn word(verdict: Verdict) -> &'static str {
fn print_spots(played: &[Played]) {
for (s, p) in SPOTS.iter().zip(played) {
println!("{:<9} {:<17} E={:>5.1}% {:<5} EV={:>+7.2} bb", s.scenario, s.hero, 100.0 * p.equity, p.action, p.sample);
println!("{:<12} {:<17} E={:>5.1}% {:<5} EV={:>+7.2} bb", s.scenario, s.hero, 100.0 * p.equity, p.action, p.sample);
}
}