Der Big Blind, der heads-up einem Button-Jam gegenuebersteht, fiel durch das blind_battle-Tor (es kannte nur SB-Open und BB-vs-Open) und landete auf der Pot-Odds-Faustregel: 13 % Call statt der ~38-48 % der Call/Jam-Tabelle - eine katastrophale Unterverteidigung, die die weite Blind-Jam-Range foldete. Jetzt greift die Tabelle (der HU-Button zaehlt als SB-Jammer), die ICM-Schicht reagiert wieder auf die Stacktiefe. turnier_benchmark liefert dem Defense-Score jetzt die History mit, sonst misst er die alte Faustregel. Frozen-Chart-Drift (cfr_multi) ist vorbestehend und owner-gated, nicht angefasst.
173 lines
6.7 KiB
Rust
173 lines
6.7 KiB
Rust
//! The CFR tables behind `advise`: which table answers which history (`preflop::cfr_advice`).
|
|
//!
|
|
//! Six-max, button on seat 3: EP 0, MP 1, CO 2, BTN 3, SB 4, BB 5. Big blind = 1.0.
|
|
use rechner::card::Card;
|
|
use rechner::exploit::thresholds::Thresholds;
|
|
use rechner::game::{ActionKind, ActionRecord, SeenAction, Spot, Street, Villain};
|
|
use rechner::preflop::advise::advise;
|
|
use rechner::preflop::plan::ChartAction;
|
|
use rechner::variant::Variant;
|
|
|
|
const MIDDLE: u8 = 1;
|
|
const SMALL_BLIND: u8 = 4;
|
|
const BIG_BLIND: u8 = 5;
|
|
|
|
fn record(seat: u8, action: SeenAction, amount: Option<f64>) -> ActionRecord {
|
|
ActionRecord { street: Street::Preflop, seat, action, amount }
|
|
}
|
|
|
|
fn blinds() -> Vec<ActionRecord> {
|
|
vec![record(4, SeenAction::PostSmallBlind, Some(0.5)), record(5, SeenAction::PostBigBlind, Some(1.0))]
|
|
}
|
|
|
|
fn spot(variant: Variant, hole: &str, hero_seat: u8, history: Vec<ActionRecord>, pot: f64, to_call: f64) -> Spot {
|
|
Spot {
|
|
variant,
|
|
big_blind: 1.0,
|
|
seats: 6,
|
|
hero_seat,
|
|
button_seat: Some(3),
|
|
hero_cards: Card::parse_list(hole).expect("cards"),
|
|
board: vec![],
|
|
street: Street::Preflop,
|
|
pot,
|
|
to_call,
|
|
hero_stack: 40.0,
|
|
min_raise_to: Some(2.0 * to_call + 1.0),
|
|
max_raise_to: Some(40.0),
|
|
legal: vec![ActionKind::Fold, ActionKind::Call, ActionKind::Raise],
|
|
allowed_sizes: None,
|
|
villains: (0..6)
|
|
.filter(|s| *s != hero_seat)
|
|
.map(|seat| Villain { seat, stack: 40.0, folded: false, profile: None })
|
|
.collect(),
|
|
seed: 1,
|
|
history,
|
|
}
|
|
}
|
|
|
|
/// MP opens to 2.5, CO and BTN fold.
|
|
fn middle_opens() -> Vec<ActionRecord> {
|
|
let mut h = blinds();
|
|
h.extend([
|
|
record(0, SeenAction::Fold, None),
|
|
record(1, SeenAction::Raise, Some(2.5)),
|
|
record(2, SeenAction::Fold, None),
|
|
record(3, SeenAction::Fold, None),
|
|
]);
|
|
h
|
|
}
|
|
|
|
fn reason(s: &Spot) -> String {
|
|
advise(s, &Thresholds::BASE).reason
|
|
}
|
|
|
|
#[test]
|
|
fn the_small_blind_facing_an_open_reads_its_own_table() {
|
|
let s = spot(Variant::Nlhe, "Ah Ad", SMALL_BLIND, middle_opens(), 4.0, 2.0);
|
|
assert!(reason(&s).contains("CFR SB vs open"), "{}", reason(&s));
|
|
assert_eq!(advise(&s, &Thresholds::BASE).action, ChartAction::Raise);
|
|
let trash = spot(Variant::Nlhe, "7c 2d", SMALL_BLIND, middle_opens(), 4.0, 2.0);
|
|
assert_eq!(advise(&trash, &Thresholds::BASE).action, ChartAction::Fold);
|
|
}
|
|
|
|
#[test]
|
|
fn the_big_blind_after_a_small_blind_fold_or_call_reads_different_tables() {
|
|
let mut folded = middle_opens();
|
|
folded.push(record(4, SeenAction::Fold, None));
|
|
let s = spot(Variant::Nlhe, "Kh Qh", BIG_BLIND, folded, 4.0, 1.5);
|
|
assert!(reason(&s).contains("CFR vs open "), "{}", reason(&s));
|
|
let mut called = middle_opens();
|
|
called.push(record(4, SeenAction::Call, Some(2.5)));
|
|
let s = spot(Variant::Nlhe, "Kh Qh", BIG_BLIND, called, 6.0, 1.5);
|
|
assert!(reason(&s).contains("CFR vs open + SB call"), "{}", reason(&s));
|
|
// There is no squeeze in the model: the big blind only folds or calls.
|
|
assert!(matches!(advise(&s, &Thresholds::BASE).action, ChartAction::Call | ChartAction::Fold));
|
|
}
|
|
|
|
#[test]
|
|
fn the_opener_facing_a_small_blind_three_bet_reads_its_own_table() {
|
|
let mut h = middle_opens();
|
|
h.extend([record(4, SeenAction::Raise, Some(11.0)), record(5, SeenAction::Fold, None)]);
|
|
let s = spot(Variant::Nlhe, "Ah Ad", MIDDLE, h, 14.5, 8.5);
|
|
assert!(reason(&s).contains("CFR vs SB 3-bet"), "{}", reason(&s));
|
|
assert_eq!(advise(&s, &Thresholds::BASE).action, ChartAction::Jam);
|
|
}
|
|
|
|
#[test]
|
|
fn the_small_blind_facing_a_jam_with_the_big_blind_behind_reads_its_own_table() {
|
|
let mut h = blinds();
|
|
h.extend([
|
|
record(0, SeenAction::Fold, None),
|
|
record(1, SeenAction::Fold, None),
|
|
record(2, SeenAction::AllIn, Some(12.0)),
|
|
record(3, SeenAction::Fold, None),
|
|
]);
|
|
let mut s = spot(Variant::Nlhe, "Ah Ad", SMALL_BLIND, h, 13.5, 11.5);
|
|
s.hero_stack = 11.5; // 12 bb minus the posted small blind: the call takes the stack
|
|
s.villains.iter_mut().for_each(|v| v.stack = 12.0);
|
|
assert!(reason(&s).contains("CFR SB vs jam"), "{}", reason(&s));
|
|
assert_eq!(advise(&s, &Thresholds::BASE).action, ChartAction::Call);
|
|
}
|
|
|
|
#[test]
|
|
fn short_deck_unopened_pots_use_the_short_deck_tables() {
|
|
let s = spot(Variant::ShortDeck, "Ah Ad", 0, blinds(), 1.5, 1.0);
|
|
let plan = advise(&s, &Thresholds::BASE);
|
|
assert!(plan.reason.contains("CFR open"), "{}", plan.reason);
|
|
assert_eq!(plan.action, ChartAction::Raise);
|
|
let trash = spot(Variant::ShortDeck, "7c 6d", 0, blinds(), 1.5, 1.0);
|
|
assert_eq!(advise(&trash, &Thresholds::BASE).action, ChartAction::Fold);
|
|
}
|
|
|
|
#[test]
|
|
fn a_caller_other_than_the_small_blind_leaves_the_tables() {
|
|
let mut h = middle_opens();
|
|
h[4] = record(2, SeenAction::Call, Some(2.5));
|
|
h.push(record(4, SeenAction::Fold, None));
|
|
let s = spot(Variant::Nlhe, "Kh Qh", BIG_BLIND, h, 6.5, 1.5);
|
|
assert!(!reason(&s).contains("CFR"), "{}", reason(&s));
|
|
}
|
|
|
|
/// True heads-up: two seats, the button (seat 0) is the small blind and jams all-in, hero is
|
|
/// the big blind on seat 1 with 10 bb.
|
|
fn heads_up_jam(hole: &str) -> Spot {
|
|
Spot {
|
|
variant: Variant::Nlhe,
|
|
big_blind: 1.0,
|
|
seats: 2,
|
|
hero_seat: 1,
|
|
button_seat: Some(0),
|
|
hero_cards: Card::parse_list(hole).expect("cards"),
|
|
board: vec![],
|
|
street: Street::Preflop,
|
|
pot: 11.0,
|
|
to_call: 9.0,
|
|
hero_stack: 9.0,
|
|
min_raise_to: None,
|
|
max_raise_to: None,
|
|
legal: vec![ActionKind::Fold, ActionKind::Call],
|
|
allowed_sizes: None,
|
|
villains: vec![Villain { seat: 0, stack: 10.0, folded: false, profile: None }],
|
|
seed: 1,
|
|
history: vec![
|
|
record(0, SeenAction::PostSmallBlind, Some(0.5)),
|
|
record(1, SeenAction::PostBigBlind, Some(1.0)),
|
|
record(0, SeenAction::AllIn, Some(10.0)),
|
|
],
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn the_heads_up_big_blind_facing_a_button_jam_reads_the_call_table() {
|
|
// Before the fix this fell to the pot-odds heuristic ("BB vs all-in, call top 13%") and
|
|
// defended far too tight. The heads-up button is the small blind, so the blind-vs-blind
|
|
// call/jam table (~38 % at 10 bb) must answer - calling hands the 13 % cutoff folded.
|
|
let s = heads_up_jam("Jh Th");
|
|
assert!(reason(&s).contains("CFR vs jam"), "{}", reason(&s));
|
|
assert_eq!(advise(&s, &Thresholds::BASE).action, ChartAction::Call);
|
|
assert_eq!(advise(&heads_up_jam("Ad 5d"), &Thresholds::BASE).action, ChartAction::Call);
|
|
// Pure trash still folds - the defense is wide, not infinite.
|
|
assert_eq!(advise(&heads_up_jam("7c 2d"), &Thresholds::BASE).action, ChartAction::Fold);
|
|
}
|