Live 14.11. (Micro-Lauf 4, Hand 177615800656, -89,5 BB): CO open-jammt 89,5 bb, Hero A7o am
BTN deckt ihn; die Chips zeigten kein All-in, die History eine Erhoehung -> "BTN vs open",
die CFR-Tabelle fuer 2,5-bb-Opens callte 99 %. Ebenso 177689800508 (75o im BB gegen 34 bb, -34 BB).
- preflop::open_jam: einzige Erhoehung all-in (ALL_IN oder Stack 0) oder committend (Erhoehung
>= Reststack) = Open-Jam. Situation FacingAllIn, Tiefe = der Jam (min der Gesamtstacks).
Blinds <= 25 bb: die Nash-Call-Tabellen; sonst Call genau dann, wenn die Equity gegen die
Nash-Push-Range des Jammer-Sitzes (bei 25 bb gedeckelt, die weiteste rationale Range) den
Preis erreicht. Exakt je Klasse mit Kartenentfernung (eingefrorene Equity-Matrix).
- Schalter OPEN_JAM=1 (Vorgabe aus = altes Verhalten), in decide.py als bekannter Schalter.
- Fixture tests/live_fixture/open_jam_2026-11-14.jsonl (alle 5 beantwortbaren Open-Jams des
Tages), Spec tests/preflop_open_jam.rs: aus = Live-Antwort, an = neu.
- open_jam_ev: Chip-EV alt/neu ueber alle Hero-Haende, 33 Spots x 8 Jam-Ranges
(messung_openjam/open_jam_ev.txt). ab_zelle zaehlt Open-Jam-Entscheidungen des Arms.
cargo test --lib und die Preflop-/Pipeline-Specs gruen; pipeline_bluff (1) und
preflop_multi_advice (3) scheitern schon auf b1f8d2e, unberuehrt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
155 lines
7.5 KiB
Rust
155 lines
7.5 KiB
Rust
//! Chip EV of the answer to an open-jam: the old engine ("vs open" tables, `OPEN_JAM` off) against
|
||
//! the new one (`OPEN_JAM=1`, `preflop::open_jam`), over every hero hand, against jam ranges of every
|
||
//! width. Exact per class (frozen class-vs-class equity matrix, card removal), no sampling.
|
||
//!
|
||
//! Spots: a six-max table, button seat 6 (SB 1, BB 2, EP 3, MP 4, CO 5, BTN 6), everybody 100 bb.
|
||
//! The jammer opens all-in for `D` bb from its seat, the seats between fold, hero acts next (or
|
||
//! later, the seats in between folded) and covers the jam. Plus the live spot itself (5-max, CO
|
||
//! jams 89.5 bb, hero BTN). For each spot and each TRUE jam range (top `w` by all-in equity, or the
|
||
//! jammer's Nash push range at min(D, 25) bb) it prints, in bb per spot (hero's hand dealt at
|
||
//! random): EV old, EV new, Δ = new − old, and the share of hands each version continues with.
|
||
//! Calls are valued heads-up (players behind fold), like the rule itself; a raise or jam against
|
||
//! an all-in is valued as a call.
|
||
//!
|
||
//! Run: `open_jam_ev` (single-threaded, < 1 min).
|
||
|
||
use rechner::cfr::chart_deck::ChartDeck;
|
||
use rechner::cfr::environment::Environment;
|
||
use rechner::cfr::hand_class::{class_combos, CLASS_COUNT};
|
||
use rechner::cfr::wake_range::{equity_against, top_membership};
|
||
use rechner::engine::decide::decide;
|
||
use rechner::game::{Choice, Spot};
|
||
use rechner::guard::enforce::enforce;
|
||
use rechner::guard::validate::check;
|
||
use rechner::json::parse;
|
||
use rechner::preflop::open_jam::{depth_bb, jam_range, open_jam, price, set_open_jam};
|
||
use rechner::wire::decode::decode;
|
||
|
||
const BB: f64 = 0.02;
|
||
const STACK_BB: f64 = 100.0;
|
||
const SEAT_NAMES: [&str; 7] = ["", "SB", "BB", "EP", "MP", "CO", "BTN"];
|
||
const WIDTHS: [f64; 7] = [0.02, 0.05, 0.10, 0.15, 0.25, 0.40, 0.60];
|
||
|
||
/// Order of action preflop at a six-max table with the button on seat 6.
|
||
const ORDER: [u8; 6] = [3, 4, 5, 6, 1, 2];
|
||
|
||
fn card(rank: &str, suit: &str) -> String {
|
||
format!(r#"{{"rank":"{rank}","suit":"{suit}"}}"#)
|
||
}
|
||
|
||
/// The six-max spot: `jammer` jams `depth` bb, hero at `hero` to act, everybody between folded.
|
||
fn six_max(jammer: u8, hero: u8, depth: f64) -> Spot {
|
||
let stack = STACK_BB * BB;
|
||
let pos = |s: u8| ORDER.iter().position(|x| *x == s).unwrap();
|
||
let (j, h) = (pos(jammer), pos(hero));
|
||
assert!(h > j);
|
||
let mut history = vec![
|
||
r#"{"street":"PREFLOP","seat":1,"action":"POST_SB","amount":0.01}"#.to_string(),
|
||
r#"{"street":"PREFLOP","seat":2,"action":"POST_BB","amount":0.02}"#.to_string(),
|
||
];
|
||
let mut folded = vec![];
|
||
for (i, s) in ORDER.iter().enumerate() {
|
||
if i < j || (i > j && i < h) {
|
||
history.push(format!(r#"{{"street":"PREFLOP","seat":{s},"action":"FOLD"}}"#));
|
||
folded.push(*s);
|
||
} else if i == j {
|
||
history.push(format!(r#"{{"street":"PREFLOP","seat":{s},"action":"ALL_IN","amount":{}}}"#, depth * BB));
|
||
}
|
||
if i >= h {
|
||
break;
|
||
}
|
||
}
|
||
let posted = |s: u8| match s {
|
||
1 => 0.01,
|
||
2 => 0.02,
|
||
_ => 0.0,
|
||
};
|
||
let villains: Vec<String> = (1..=6u8)
|
||
.filter(|s| *s != hero)
|
||
.map(|s| {
|
||
let left = if s == jammer { 0.0 } else { stack - posted(s) };
|
||
format!(r#"{{"seat":{s},"stack":{left},"folded":{}}}"#, folded.contains(&s))
|
||
})
|
||
.collect();
|
||
let dead: f64 = [1u8, 2].iter().filter(|s| **s != jammer).map(|s| posted(*s)).sum();
|
||
let pot = dead + depth * BB;
|
||
let to_call = depth * BB - posted(hero);
|
||
let hero_stack = stack - posted(hero);
|
||
let json = format!(
|
||
r#"{{"variant":"NLHE","bigBlind":{BB},"seats":6,"heroSeat":{hero},"heroCards":[{},{}],"street":"PREFLOP","pot":{pot},"toCall":{to_call},"heroStack":{hero_stack},"minRaiseTo":{stack},"maxRaiseTo":{stack},"legalActions":["FOLD","CALL","RAISE"],"villains":[{}],"history":[{}]}}"#,
|
||
card("TWO", "CLUBS"),
|
||
card("SEVEN", "DIAMONDS"),
|
||
villains.join(","),
|
||
history.join(",")
|
||
);
|
||
check(decode(&parse(&json).unwrap()).unwrap()).unwrap()
|
||
}
|
||
|
||
/// The live spot (hand 177615800656), without the reads.
|
||
fn live() -> Spot {
|
||
let json = r#"{"variant":"NLHE","bigBlind":0.02,"seats":5,"heroSeat":2,"heroCards":[{"rank":"ACE","suit":"CLUBS"},{"rank":"SEVEN","suit":"DIAMONDS"}],"street":"PREFLOP","pot":1.82,"toCall":1.79,"heroStack":1.98,"minRaiseTo":1.98,"maxRaiseTo":1.98,"legalActions":["FOLD","CALL","RAISE"],"villains":[{"seat":1,"stack":0.0,"folded":false},{"seat":3,"stack":1.95,"folded":false},{"seat":4,"stack":3.32,"folded":false},{"seat":5,"stack":1.99,"folded":true}],"history":[{"street":"PREFLOP","seat":3,"action":"POST_SB","amount":0.01},{"street":"PREFLOP","seat":4,"action":"POST_BB","amount":0.02},{"street":"PREFLOP","seat":5,"action":"FOLD"},{"street":"PREFLOP","seat":1,"action":"ALL_IN","amount":1.79}]}"#;
|
||
check(decode(&parse(json).unwrap()).unwrap()).unwrap()
|
||
}
|
||
|
||
/// Does the engine continue (call, raise) with this class? Per class, one representative combo.
|
||
fn continues(spot: &Spot, on: bool) -> Vec<Option<bool>> {
|
||
set_open_jam(on);
|
||
(0..CLASS_COUNT)
|
||
.map(|c| {
|
||
let combo = class_combos(c).into_iter().next()?;
|
||
let mut s = spot.clone();
|
||
s.hero_cards = combo.to_vec();
|
||
let d = enforce(&s, decide(&s));
|
||
Some(matches!(d.choice, Choice::Call | Choice::Raise { .. }))
|
||
})
|
||
.collect()
|
||
}
|
||
|
||
fn main() {
|
||
let env = Environment::frozen_for(ChartDeck::Full);
|
||
let mut spots: Vec<(String, Spot)> = vec![("live 5max CO 89.5bb -> BTN".to_string(), live())];
|
||
for depth in [12.0, 20.0, 40.0, 90.0] {
|
||
for (jammer, hero) in [(3u8, 6u8), (5, 6), (5, 1), (5, 2), (6, 1), (6, 2), (1, 2), (3, 5)] {
|
||
spots.push((format!("{} jams {depth}bb -> {}", SEAT_NAMES[jammer as usize], SEAT_NAMES[hero as usize]), six_max(jammer, hero, depth)));
|
||
}
|
||
}
|
||
let total: f64 = (0..CLASS_COUNT).map(|c| env.chance.combos(c) as f64).sum();
|
||
println!("spot | true jam range | EV old bb | EV new bb | delta bb | continue old | continue new");
|
||
let mut worst = f64::INFINITY;
|
||
for (name, spot) in &spots {
|
||
let jam = open_jam(spot).expect("open-jam");
|
||
let (call, pot) = price(spot, &jam);
|
||
let (old, new) = (continues(spot, false), continues(spot, true));
|
||
let depth = depth_bb(spot, &jam);
|
||
let nash = jam_range(spot, &jam, depth);
|
||
let mut ranges: Vec<(String, Vec<f64>)> =
|
||
WIDTHS.iter().map(|w| (format!("top {:.0}%", 100.0 * w), top_membership(&env, *w))).collect();
|
||
if let Some((m, w)) = nash {
|
||
ranges.push((format!("Nash push ({:.0}%)", 100.0 * w), m));
|
||
}
|
||
let share = |v: &[Option<bool>]| {
|
||
(0..CLASS_COUNT).filter(|c| v[*c] == Some(true)).map(|c| env.chance.combos(c) as f64).sum::<f64>() / total
|
||
};
|
||
for (label, m) in &ranges {
|
||
let eq = equity_against(&env, m);
|
||
let ev = |v: &[Option<bool>]| -> f64 {
|
||
(0..CLASS_COUNT)
|
||
.filter(|c| v[*c] == Some(true))
|
||
.map(|c| env.chance.combos(c) as f64 / total * (eq[c] * pot - call))
|
||
.sum::<f64>()
|
||
/ spot.big_blind
|
||
};
|
||
let (a, b) = (ev(&old), ev(&new));
|
||
worst = worst.min(b - a);
|
||
println!(
|
||
"{name} | {label} | {a:+.3} | {b:+.3} | {:+.3} | {:.1}% | {:.1}%",
|
||
b - a,
|
||
100.0 * share(&old),
|
||
100.0 * share(&new)
|
||
);
|
||
}
|
||
}
|
||
set_open_jam(false);
|
||
println!("worst delta over all spots and ranges: {worst:+.3} bb");
|
||
}
|