//! Probe (nemesis3-river, 15.11.): which RAW read fields separate the turn raisers? Plays the ladder's //! Memory-read sessions against nemesis-2, nemesis-3 and maniac and averages the raw (ungated) villain //! profile hero sees in the second half of each session, plus the villain's real turn-raise frequency //! facing hero's turn bet. Check-raise is switched on as a line read HERE ONLY (it moves hero's bluffing, //! so the other averages come from a slightly different hero; the read itself is the same). //! //! Run: `probe_read [deals=2000]`, one cell per opponent, threads from `POKERBENCH_THREADS` (default 2). use rechner::game::{SeenAction, Street}; use rechner::sim::opponent::Opponent; use rechner::sim::reader::{Rules, Style}; use rechner::sim::session::{deal_trace_memory, ReadMode, Setup}; use std::sync::Mutex; const KLASSIK_SEED: u64 = 0x5EED_0001; const N2: Rules = Rules { call_margin: 0.173, raise_at: 0.579, bet_at: 0.748, open_at: 0.800, bluff: 0.229, size: 0.996 }; const N3: Rules = Rules { call_margin: 0.396, raise_at: 0.769, bet_at: 0.615, open_at: 0.468, bluff: 0.261, size: 1.148 }; fn main() { let deals: u32 = std::env::args().nth(1).and_then(|x| x.parse().ok()).unwrap_or(2000); let threads: usize = std::env::var("POKERBENCH_THREADS").ok().and_then(|x| x.parse().ok()).unwrap_or(2).max(1); let gegner: Vec<(&str, Opponent)> = vec![("nemesis-2", Opponent::Styled(N2)), ("nemesis-3", Opponent::Styled(N3)), ("maniac", Opponent::Reader(Style::Maniac))]; let out = Mutex::new(Vec::new()); let next = std::sync::atomic::AtomicUsize::new(0); std::thread::scope(|sc| { for _ in 0..threads.min(gegner.len()) { sc.spawn(|| { rechner::sim::memory::set_line_reads(rechner::sim::memory::READ_CHECK_RAISE); loop { let j = next.fetch_add(1, std::sync::atomic::Ordering::Relaxed); let Some((name, opp)) = gegner.get(j) else { break }; let setup = Setup { players: 2, opponent: *opp, deals, stack_bb: 100.0, seed: KLASSIK_SEED, read: ReadMode::Memory }; let mut s = [0.0f64; 6]; let mut n = [0u32; 6]; let (mut chances, mut raises) = (0u32, 0u32); deal_trace_memory(&setup, |i, _, _, _, trace| { if i >= deals / 2 { for d in trace { if let Some(p) = d.spot.live_villains().next().and_then(|v| v.profile.as_ref()) { let f = [p.aggression, p.turn_aggression, p.check_raise, p.fold_to_bet, p.aggression_confidence.or(p.confidence), p.raise_to_bet]; for (k, x) in f.into_iter().enumerate() { if let Some(x) = x.filter(|x| !x.is_nan()) { s[k] += x; n[k] += 1; } } } } } // Villain's answer to hero's turn bet (seen when hero acted again on the turn or later). if let Some(last) = trace.last() { let h = &last.spot.history; let hero = last.spot.hero_seat; if let Some(b) = h.iter().position(|r| r.street == Street::Turn && r.seat == hero && r.action.is_aggressive()) { if let Some(ans) = h[b + 1..].iter().find(|r| r.street == Street::Turn && r.seat != hero) { chances += 1; raises += matches!(ans.action, SeenAction::Raise | SeenAction::AllIn) as u32; } } } }); let m = |k: usize| if n[k] > 0 { s[k] / n[k] as f64 } else { f64::NAN }; out.lock().unwrap().push(format!( "{name:10} aggression {:.3} turn_aggr {:.3} check_raise {:.3} fold_to_bet {:.3} konf {:.3} raise_to_bet {:.3} | Turn-Raise auf Hero-Einsatz (gesehen) {raises}/{chances} = {:.3}", m(0), m(1), m(2), m(3), m(4), m(5), raises as f64 / chances.max(1) as f64 )); } }); } }); for l in out.into_inner().unwrap() { println!("{l}"); } }