Files
pokerfreak/tests/preflop_ohne_ante.rs
mmintelandClaude Opus 5.5 f0d1254179 PREFLOP_OHNE_ANTE: Open-Tabellen ohne Antes (Schalter, Vorgabe aus)
Die eingefrorenen Tabellen rechnen 0,96 bb Antes; live Micro hat keine
(2703/2703 Haende). chartgen charts --ohne-ante --nur-open loest die 15
Open-Spiele ohne Antes (63 min, 2 Threads Idle). Mit dem Schalter liest
generated_lookup diese Tabellen; multi_lookup liest die ante-freien
Multi-/Tiefen-Dateien, solange sie leer sind die alten (Lauf eingereiht).
Push/Fold bleibt mit Antes (Turnier).

- BB-Verteidigung (Anteil aller Haende) z. B. vs BTN 100bb 72 % -> 44 %,
  vs SB 100bb 84 % -> 53 %; Opens je Sitz 6-9 Punkte enger.
- Aus: bit-identisch zum Live-Kern auf 2776 echten Spots.
- An: 102/2776 Aktionen kippen (3,7 %), meist BB vs open CALL->FOLD
  (35, live -137 bb in diesen Haenden); messung_preflop/replay_ohneante.md.
- Schalter in decide.py/roentgen.py BEKANNTE_SCHALTER; tests/preflop_ohne_ante.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 00:48:41 +01:00

84 lines
3.8 KiB
Rust

//! Spec: `PREFLOP_OHNE_ANTE` reads the open tables solved WITHOUT the table antes.
//!
//! The frozen open / multi tables carry six antes of 0.16 bb (0.96 bb dead money). Live micro cash
//! (0.01/0.02) has none: 14.11. 2703 of 2703 hands with ante 0. `chartgen charts --ohne-ante
//! --nur-open` solves the same 15 open games without them (`generated_charts_ohne_ante`).
//!
//! The switch is process-global: everything that toggles it runs in ONE test, in order.
use rechner::cfr::hand_class::{class_parse, CLASS_COUNT};
use rechner::cfr::seat::Seat;
use rechner::preflop::ante::set_ohne_ante;
use rechner::preflop::generated_charts::{OPEN, OPEN_DEPTHS};
use rechner::preflop::generated_charts_ohne_ante::OPEN as OPEN_OHNE_ANTE;
use rechner::preflop::generated_lookup::{open_frequency, push_frequency, vs_open};
use rechner::variant::Variant;
/// Combo-weighted share of hands the row plays (permille rows).
fn width(row: &[u16; CLASS_COUNT]) -> f64 {
let combos = |c: usize| {
let name = rechner::cfr::hand_class::class_name(c as _).unwrap_or_default();
if name.len() == 2 { 6.0 } else if name.ends_with('s') { 4.0 } else { 12.0 }
};
(0..CLASS_COUNT).map(|c| combos(c) * row[c] as f64 / 1000.0).sum::<f64>() / 1326.0
}
fn defend_width(row: &[[u16; 2]; CLASS_COUNT]) -> f64 {
let mut both = [0u16; CLASS_COUNT];
for c in 0..CLASS_COUNT {
both[c] = row[c][0] + row[c][1];
}
width(&both)
}
#[test]
fn the_switch_reads_the_ante_free_tables_and_nothing_else() {
// The file covers the same plan: every seat at every open depth, once.
assert_eq!(OPEN_OHNE_ANTE.len(), OPEN.len(), "ante-free tables solved (chartgen charts --ohne-ante --nur-open)");
for (a, b) in OPEN.iter().zip(OPEN_OHNE_ANTE.iter()) {
assert_eq!((a.seat, a.depth_bb), (b.seat, b.depth_bb));
}
let header = include_str!("../src/preflop/generated_charts_ohne_ante.rs");
assert!(header.contains("NO antes"), "the file says what it is");
let aa = class_parse("AA").expect("AA");
let k4o = class_parse("K4o").expect("K4o");
// Off: the lookup is the frozen table with antes, entry for entry.
set_ohne_ante(false);
for s in OPEN.iter() {
for c in [aa, k4o] {
let f = open_frequency(Variant::Nlhe, s.seat, s.depth_bb as f64, c).expect("open");
assert!((f.raise - s.open[c] as f64 / 1000.0).abs() < 1e-12);
}
}
let push_off = push_frequency(Variant::Nlhe, Seat::Button, 10.0, k4o).expect("push");
// On: the ante-free table, entry for entry; push / fold stays with antes (tournaments).
set_ohne_ante(true);
for s in OPEN_OHNE_ANTE.iter() {
for c in [aa, k4o] {
let f = open_frequency(Variant::Nlhe, s.seat, s.depth_bb as f64, c).expect("open");
assert!((f.raise - s.open[c] as f64 / 1000.0).abs() < 1e-12);
}
let v = vs_open(Variant::Nlhe, s.seat, s.depth_bb as f64, aa).expect("defend");
assert!(v.fold < 0.01, "{:?} {}: BB folds aces", s.seat, s.depth_bb);
}
assert_eq!(push_frequency(Variant::Nlhe, Seat::Button, 10.0, k4o).expect("push"), push_off);
set_ohne_ante(false);
// Without dead money every pot is dearer to enter: the opens and the big blind's defence
// against them are narrower than with antes, at every seat and depth.
for (a, b) in OPEN.iter().zip(OPEN_OHNE_ANTE.iter()) {
let tag = format!("{} {}bb", a.seat.label(), a.depth_bb);
assert!(width(&b.open) < width(&a.open), "{tag}: open {} vs {} with antes", width(&b.open), width(&a.open));
assert!(
defend_width(&b.defend) < defend_width(&a.defend) + 0.01,
"{tag}: BB defends {} vs {} with antes",
defend_width(&b.defend),
defend_width(&a.defend)
);
}
assert_eq!(OPEN_DEPTHS, [20, 40, 100]);
}