Files
pokerfreak/tests/engine_read_exploit.rs
T
mmintelandClaude Opus 5.5 faa29b3a1b D1d: Lesen breit (engine::read_exploit, GEGNER_BREIT aus) + Gedaechtnis-Draht profile.reads
- read_exploit: Reads der blind gespielten Stile (Nit/Reg/Maniac) ueber fuenf schmale Kanaele:
  c C-Bet vs Folder, b Bluff-Veto vs Caller, r River fold->call, w River-Duennwert (nur Equity >= 0,5),
  3 Light-3-Bet; jeder Read in KL-Vertrauensregion um den Blind-Wert, Stationen/Multiway/Turnier bitgleich.
- river_br (aus pausiertem WIP 1033e80 uebernommen): node-locked BR, Worst-Case ueber Belief-Box, KL-Budget;
  dient als r/w. river_subgame: ladder_chance, belief_combos.
- decode_villain: profile.reads {n,k,prior} -> Posterior + Vertrauen; neue Felder flop_aggression,
  fold_to_steal, fold_to_raise. Kein reads = bitgleich.
- Replay 1345 echte Zuege: Lesen aendert 0,67 % -> 0,74 % (breit), 1,04 % mit Gedaechtnis-Reads.
- Arme eingereiht (eintraege_breit.txt): Leiter breit-basis/-alle/-c/-b/-rw/-3, LBR typ/nit/maniac.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 22:42:05 +01:00

105 lines
4.1 KiB
Rust

//! Breite Ausnutzung (`engine::read_exploit`, Schalter GEGNER_BREIT): ein Read, den der Riegel blind
//! spielt (Nit, Reg, Maniac), darf nur ueber wenige, begrenzte Kanaele wirken. Hier: der C-Bet-Druck
//! gegen einen Folder und das Bluff-Veto gegen einen Caller, je am konkreten Spot; Station und Schalter
//! aus lassen die Entscheidung unberuehrt.
use rechner::card::Card;
use rechner::engine::read_exploit::{postflop_with, Channels};
use rechner::exploit::profile::Profile;
use rechner::game::{ActionKind, ActionRecord, Choice, Decision, SeenAction, Spot, Street, Villain};
use rechner::read::hand_read::read;
use rechner::variant::Variant;
fn rec(street: Street, seat: u8, action: SeenAction, amount: Option<f64>) -> ActionRecord {
ActionRecord { street, seat, action, amount }
}
/// Heads-up flop, hero (seat 0) raised preflop, villain (seat 1) called and checked the flop.
fn flop(hero: &str, profile: Option<Profile>) -> Spot {
Spot {
variant: Variant::Nlhe,
big_blind: 1.0,
seats: 2,
hero_seat: 0,
button_seat: Some(0),
hero_cards: Card::parse_list(hero).unwrap(),
board: Card::parse_list("Kc 8d 3s").unwrap(),
street: Street::Flop,
pot: 6.0,
to_call: 0.0,
hero_stack: 97.0,
min_raise_to: Some(1.0),
max_raise_to: Some(97.0),
legal: vec![ActionKind::Check, ActionKind::Raise],
allowed_sizes: None,
villains: vec![Villain { seat: 1, stack: 97.0, folded: false, profile }],
seed: 7,
history: vec![
rec(Street::Preflop, 0, SeenAction::Raise, Some(3.0)),
rec(Street::Preflop, 1, SeenAction::Call, Some(3.0)),
rec(Street::Flop, 1, SeenAction::Check, None),
],
}
}
fn nit(fold_to_cbet: f64, confidence: f64) -> Option<Profile> {
Some(Profile {
vpip: Some(0.14),
pfr: Some(0.11),
fold_to_bet: Some(0.70),
aggression: Some(0.25),
fold_to_cbet: Some(fold_to_cbet),
confidence: Some(confidence),
..Profile::default()
})
}
fn decision(choice: Choice, equity: f64) -> Decision {
Decision::new(choice, 0.6, "heuristic").with_equity(equity)
}
#[test]
fn ein_sicherer_cbet_folder_bekommt_die_kleine_cbet() {
let spot = flop("7h 6h", nit(0.85, 0.8));
let hand = read(&spot.rules(), &spot.hero_cards, &spot.board).unwrap();
let ch = Channels::parse("c");
let d = postflop_with(ch, &spot, &hand, decision(Choice::Check, 0.2));
match d.choice {
Choice::Raise { to } => assert!(to > 0.0 && to <= 0.5 * spot.pot, "small c-bet, got {to}"),
other => panic!("expected a c-bet, got {other:?}"),
}
assert!(d.reason.starts_with("breit:c"));
// Schalter aus, duenner Read, Station: unberuehrt.
let base = decision(Choice::Check, 0.2);
assert_eq!(postflop_with(Channels::default(), &spot, &hand, base.clone()), base);
let thin = flop("7h 6h", nit(0.85, 0.1));
assert_eq!(postflop_with(ch, &thin, &hand, base.clone()), base);
let station = flop(
"7h 6h",
Some(Profile { vpip: Some(0.6), pfr: Some(0.05), fold_to_bet: Some(0.2), fold_to_cbet: Some(0.85), confidence: Some(0.9), ..Profile::default() }),
);
assert_eq!(postflop_with(ch, &station, &hand, base.clone()), base);
}
#[test]
fn gegen_einen_sicheren_caller_kein_reiner_bluff() {
let caller = Some(Profile {
vpip: Some(0.26),
pfr: Some(0.2),
fold_to_bet: Some(0.15),
aggression: Some(0.5),
fold_to_cbet: Some(0.15),
confidence: Some(0.9),
..Profile::default()
});
let spot = flop("5h 4d", caller);
let hand = read(&spot.rules(), &spot.hero_cards, &spot.board).unwrap();
let bet = decision(Choice::Raise { to: 4.0 }, 0.15);
let d = postflop_with(Channels::parse("b"), &spot, &hand, bet.clone());
assert_eq!(d.choice, Choice::Check, "{}", d.reason);
assert!(d.reason.starts_with("breit:b"));
// Gegen einen Folder bleibt der Bluff.
let folder = flop("5h 4d", nit(0.85, 0.9));
assert_eq!(postflop_with(Channels::parse("b"), &folder, &hand, bet.clone()), bet);
}