Replay-Harness (entscheiden/replay.py, eval7.py, tests/replay_spec.py): rekonstruiert Hero- Entscheidungen aus echten Hand-Histories, misst Fold-to-bet, den Equity-Bias gegen einen unabhaengigen Evaluator und den belegten EV-Verlust (Overfold/Overcall). benchmarks/replay_*.txt frieren Vorher/Nachher ein. Wurzel am Equity-Bias (exploit/bluff_share.rs, street_continuation.rs): der Micro-Pool barrelt ueber GTO-Balance, also bekommt eine UNGELESENE Range (profile None, auch blind gegatet) auf dem ERSTEN Barrel einen Populations-Ueber-Bluff-Prior (with_pop_prior, barrel-bewusst - ein Sustained- Barrel bleibt value-gewichtet). bluff_share bleibt rein. Overfold im Replay 40.6 -> 7.5 bb, Bias -0.221 -> -0.186. MDF-River-Boden (exploit/mdf_floor.rs, engine/decide.rs): ein River-Fold einer verteidigbaren Made-Hand gegen eine Range, die bluffen kann, wird zum Call (MDF/Break-even), ausser jeder lebende Gegner ist ein belegter Under-Bluffer. Laeuft auf dem UNGEGATETEN Spot, Kern-EV unangetastet. Stage 0 - Blind-Messlatte (sim/session.rs, table.rs, benchmark.rs, tests/sim_blind.rs): ein neues blind-Feld haelt den HUD-Read zurueck; zwei Blind-Szenarien (Fisch, Calling Station) beziffern den Sitzungsertrag eines Reads (Fisch +53.8, Station +26.3 bb/100). Die 10 alten Szenarien bleiben Bit fuer Bit gleich; baseline.txt neu mit 12 Szenarien. Kein Rueckschritt auf der Messlatte. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
94 lines
3.4 KiB
Rust
94 lines
3.4 KiB
Rust
//! Diagnose: woher kommt der Equity-Bias? Fuer jeden Wire-Spot von stdin wird die MODELLIERTE
|
|
//! Gegner-Range gedumpt und Heros Equity dagegen gemessen - einmal wie die Engine sie baut und
|
|
//! dann mit hochgedrehtem `bluff_share` je Continuation. Die Kurve zeigt, wie viel des Overfolds
|
|
//! an der (zu GTO-balancierten) Bluff-Annahme haengt.
|
|
//!
|
|
//! cat spots.ndjson | cargo run --release --example diag_bluff
|
|
|
|
use std::io::Read;
|
|
|
|
use rechner::card::Card;
|
|
use rechner::engine::range_combos::{as_ranges, combos};
|
|
use rechner::engine::range_filter::{range_filter, HandFilter};
|
|
use rechner::equity::monte_carlo::estimate;
|
|
use rechner::equity::query::Query;
|
|
use rechner::exploit::range_model::range_spec;
|
|
use rechner::exploit::range_spec::RangeSpec;
|
|
use rechner::game::Spot;
|
|
use rechner::rng::Rng;
|
|
|
|
const TRIALS: u32 = 40_000; // hohe Trials -> Standardfehler ~0.0025, der Bias ist sichtbar
|
|
|
|
fn specs(spot: &Spot, bluff: Option<f64>) -> Vec<RangeSpec> {
|
|
spot.live_villains()
|
|
.map(|v| {
|
|
let mut s = range_spec(spot, v);
|
|
if let Some(b) = bluff {
|
|
for c in s.continues.iter_mut() {
|
|
c.bluff_share = b;
|
|
}
|
|
}
|
|
s
|
|
})
|
|
.collect()
|
|
}
|
|
|
|
fn hero_share(spot: &Spot, bluff: Option<f64>) -> f64 {
|
|
let rules = spot.rules();
|
|
let specs = specs(spot, bluff);
|
|
let filters: Vec<HandFilter> = specs
|
|
.iter()
|
|
.map(|s| range_filter(s, rules, spot.variant, &spot.board))
|
|
.collect();
|
|
if filters.is_empty() {
|
|
return f64::NAN;
|
|
}
|
|
let dead: Vec<Card> = spot.hero_cards.iter().chain(&spot.board).copied().collect();
|
|
let lists: Vec<_> = filters.iter().map(|f| combos(&rules, f, &dead)).collect();
|
|
let ranges = as_ranges(&filters, &lists);
|
|
let query = Query { rules, hero: &spot.hero_cards, board: &spot.board, villains: &ranges, trials: TRIALS };
|
|
estimate(&query, Rng::seeded(spot.seed)).map(|(e, _)| e.share).unwrap_or(f64::NAN)
|
|
}
|
|
|
|
fn fmt_cards(cs: &[Card]) -> String {
|
|
cs.iter().map(|c| format!("{c:?}")).collect::<Vec<_>>().join(" ")
|
|
}
|
|
|
|
fn diagnose(spot: &Spot) {
|
|
println!(
|
|
"--- {:?} [{}] | hero [{}] | pot {:.2} call {:.2} ---",
|
|
spot.street,
|
|
fmt_cards(&spot.board),
|
|
fmt_cards(&spot.hero_cards),
|
|
spot.pot,
|
|
spot.to_call
|
|
);
|
|
for v in spot.live_villains() {
|
|
let s = range_spec(spot, v);
|
|
let conts: Vec<String> = s
|
|
.continues
|
|
.iter()
|
|
.map(|c| format!("len{} >={:?} draws={} bluff={:.2}", c.board_len, c.min_made, c.draws_continue, c.bluff_share))
|
|
.collect();
|
|
println!(" villain seat {}: band [{:.2}..{:.2}] {}", v.seat, s.lo, s.hi, conts.join(" | "));
|
|
}
|
|
let base = hero_share(spot, None);
|
|
println!(" hero equity (Modell wie gebaut): {base:.3}");
|
|
print!(" bei bluff_share =");
|
|
for b in [0.15, 0.30, 0.45, 0.60, 0.75, 0.90] {
|
|
print!(" {:.2}->{:.3}", b, hero_share(spot, Some(b)));
|
|
}
|
|
println!();
|
|
}
|
|
|
|
fn main() {
|
|
let mut input = String::new();
|
|
std::io::stdin().read_to_string(&mut input).expect("stdin");
|
|
for line in input.lines().map(str::trim).filter(|l| !l.is_empty()) {
|
|
match rechner::json::parse(line).and_then(|v| rechner::wire::decode::decode(&v)) {
|
|
Ok(spot) => diagnose(&spot),
|
|
Err(e) => eprintln!("decode failed: {e} on: {}", &line[..line.len().min(80)]),
|
|
}
|
|
}
|
|
}
|