Files
pokerfreak/tests/bluff_range.rs
T
mmintelandClaude Opus 5.5 0923eca24c Familie A + Bettor-Modell: Tor 17.11., UEBERSCHUSS Live-Kandidat, BETTOR verworfen
Messschalter, ungesetzt bitgleich (basis gg. basisb 0 Deals):
- UEBERSCHUSS=1 (engine/ueberschuss.rs): der ungecallte Teil eines Einsatzes, der den
  Helden all-in setzt, kommt aus dem Topf (einmal gekuerzt, keine Rekursion). Sim bitgleich
  in allen 12 Zellen, 6-max, LBR; Live-Replay 2 All-in-Folds -> kein Verlierer.
- BETTOR=<Tabelle> (exploit/bettor.rs, range_filter): P(Antwort | Brett-Perzentil) je
  Wettknoten aus PHH 8,1 Mio. + NL2. Live-Replay besser (River-Fold klein 77->53 %),
  Sim-Tor Verlierer, auch gegen tabellentreue Gegner -> verworfen.
- GEGEN_GROSS=t: Spitzenschnitt gegen grosse Einsaetze, allein Verlierer.
- SIM_BETTOR=<Tabelle> (sim/bettor_tor.rs): Pool-Gegner setzen nach der Tabelle.

Werkzeuge: bettor.py (mit Muck-Korrektur), replay.py (Live-Replay-Tor, ABSTAIN zaehlt als
Fold), familie_c.py, echtfaelle.py, lesen/phh_linien.py. Zahlen in messung/familie_a/TOR.md,
STAND §22. Keine Gegnerkennung.

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

97 lines
3.3 KiB
Rust

//! Spec: a betting range keeps a bluff fraction.
//!
//! A continuation with `bluff_share = b` lets hands below its floor through with a fixed,
//! per-hand acceptance so that, over all starting hands in the preflop band, the hands
//! below the floor make up `b` of what passes. Without it a bet is read as pure value
//! and hero folds every bluff catcher (systematic under-calling).
mod spot_fixture;
use rechner::card::{deck, Card};
use rechner::engine::range_filter::range_filter;
use rechner::exploit::range_spec::{Continuation, RangeSpec};
use rechner::read::glance::glance;
use rechner::read::made::Made;
use rechner::variant::{rules, Variant};
use spot_fixture::cards;
fn spec(bluff_share: f64) -> RangeSpec {
RangeSpec {
lo: 0.0,
hi: 0.6,
continues: vec![Continuation {
board_len: 5,
min_made: Made::TopPairGoodKicker,
draws_continue: false,
min_draw: rechner::read::draw::Draw::Gutshot,
bluff_share,
continue_share: None,
top_share: None,
min_strength: None,
likelihood: None,
}],
}
}
fn all_hands(board: &[Card]) -> Vec<[Card; 2]> {
let pool = deck::without(board);
(0..pool.len())
.flat_map(|i| (i + 1..pool.len()).map(move |j| (i, j)))
.map(|(i, j)| [pool[i], pool[j]])
.collect()
}
/// (passing hands, of which below the floor)
fn census(b: f64) -> (usize, usize) {
let board = cards("Kd 8s 4c 2h Jc");
let filter = range_filter(&spec(b), rules(Variant::Nlhe), Variant::Nlhe, &board);
let r = rules(Variant::Nlhe);
all_hands(&board).iter().filter(|h| filter(&h[..])).fold((0, 0), |(n, air), h| {
let below = glance(&r, &h[..], &board).map_or(true, |(m, _)| m < Made::TopPairGoodKicker);
(n + 1, air + usize::from(below))
})
}
#[test]
fn without_a_bluff_share_only_value_passes() {
let (n, air) = census(0.0);
assert!(n > 0);
assert_eq!(air, 0);
}
#[test]
fn the_bluff_share_is_met_over_the_whole_range() {
for b in [0.1, 0.25, 0.4] {
let (n, air) = census(b);
let share = air as f64 / n as f64;
assert!((share - b).abs() < 0.03, "b = {b}: {air}/{n} = {share:.3}");
}
}
#[test]
fn acceptance_is_fixed_per_hand_and_order_free() {
let board = cards("Kd 8s 4c 2h Jc");
let f = range_filter(&spec(0.3), rules(Variant::Nlhe), Variant::Nlhe, &board);
let g = range_filter(&spec(0.3), rules(Variant::Nlhe), Variant::Nlhe, &board);
for h in all_hands(&board).iter().take(400) {
let swapped = [h[1], h[0]];
assert_eq!(f(&h[..]), g(&h[..]));
assert_eq!(f(&h[..]), f(&swapped[..]));
}
}
#[test]
fn five_card_ranges_get_bluffs_too() {
let board = cards("Kd 8s 4c 2h Jc");
let f = range_filter(&spec(0.3), rules(Variant::Plo5), Variant::Plo5, &board);
// A hand with no pair at all on this board still passes sometimes.
let pool = deck::without(&board);
let passing_air = (0..300)
.map(|i| [0, 7, 13, 21, 29].map(|k| pool[(i * 3 + k) % pool.len()]))
.filter(|h| h.iter().enumerate().all(|(i, c)| !h[..i].contains(c)))
.filter(|h| glance(&rules(Variant::Plo5), &h[..], &board).is_ok_and(|(m, _)| m < Made::TopPairGoodKicker))
.filter(|h| f(&h[..]))
.count();
assert!(passing_air > 0);
}