diff --git a/messung_n3/pilot4.sh b/messung_n3/pilot4.sh new file mode 100644 index 00000000..66574690 --- /dev/null +++ b/messung_n3/pilot4.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Pilot xr (2 Threads Idle, nacheinander): Basis READS=xr, dann TURN_RAISE_BLUFF=0 TURN_RAISE_NUR=xr:0.15 +cd "$(dirname "$0")/.." +export MDF_UNREAD=0 TURN_SPIEL=grund OPEN_JAM=1 RAKE_LIVE=1 POKERBENCH_THREADS=2 READS=xr +export GRUNDSTRATEGIE='D:\Projects\pokerfreak\.claude\worktrees\engine-lecks-angreifen-de7b88\daten' +R=nemesis-2,nemesis-2@blind,nemesis-3,cbet-folder,maniac +B=messung_n3/bin/pokerbench-n3-xr.exe +start //b //wait //low $B messung_n3/arme/pilot-xrbasis 2000 4000 4 $R > messung_n3/pilot4-basis.log 2>&1 +TURN_RAISE_BLUFF=0 TURN_RAISE_NUR=xr:0.15 start //b //wait //low $B messung_n3/arme/pilot-xr015 2000 4000 4 $R > messung_n3/pilot4-xr015.log 2>&1 diff --git a/messung_n3/probe.txt b/messung_n3/probe.txt new file mode 100644 index 00000000..8687c4d2 --- /dev/null +++ b/messung_n3/probe.txt @@ -0,0 +1,3 @@ +nemesis-2 aggression 0.360 turn_aggr 0.345 check_raise 0.286 fold_to_bet 0.562 konf 0.955 | Turn-Raise auf Hero-Einsatz (gesehen) 159/310 = 0.513 +nemesis-3 aggression 0.492 turn_aggr 0.406 check_raise 0.075 fold_to_bet 0.739 konf 0.890 | Turn-Raise auf Hero-Einsatz (gesehen) 24/61 = 0.393 +maniac aggression 0.482 turn_aggr 0.421 check_raise 0.029 fold_to_bet 0.325 konf 0.976 | Turn-Raise auf Hero-Einsatz (gesehen) 108/588 = 0.184 diff --git a/src/bin/probe_read.rs b/src/bin/probe_read.rs new file mode 100644 index 00000000..22e7c7ee --- /dev/null +++ b/src/bin/probe_read.rs @@ -0,0 +1,79 @@ +//! 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; 5]; + let mut n = [0u32; 5]; + 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)]; + 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} | Turn-Raise auf Hero-Einsatz (gesehen) {raises}/{chances} = {:.3}", + m(0), + m(1), + m(2), + m(3), + m(4), + raises as f64 / chances.max(1) as f64 + )); + } + }); + } + }); + for l in out.into_inner().unwrap() { + println!("{l}"); + } +} diff --git a/src/exploit/street_continuation.rs b/src/exploit/street_continuation.rs index c7bca998..9a835b92 100644 --- a/src/exploit/street_continuation.rs +++ b/src/exploit/street_continuation.rs @@ -114,6 +114,9 @@ enum NurModus { Alle, Gelesen, Roh, + /// `TURN_RAISE_NUR=xr:`: nur wenn der ROHE Check-Raise-Read unter `s` liegt (ein seltener Raiser + /// erhoeht eng; Sonde 15.11. Memory: nemesis-2 0,286 erhoeht weit, nemesis-3 0,075, maniac 0,029). + Xr(f64), } fn nur_modus() -> NurModus { @@ -122,6 +125,7 @@ fn nur_modus() -> NurModus { *M.get_or_init(|| match std::env::var("TURN_RAISE_NUR").as_deref() { Ok("gelesen") => NurModus::Gelesen, Ok("roh") => NurModus::Roh, + Ok(v) if v.starts_with("xr:") => v[3..].parse::().ok().filter(|x| x.is_finite()).map_or(NurModus::Alle, NurModus::Xr), _ => NurModus::Alle, }) } @@ -134,10 +138,12 @@ thread_local! { /// Von `decide_with` vor dem Gate aufgerufen: merkt die Sitze mit rohem (ungegatetem) Read. Ohne /// `TURN_RAISE_NUR=roh` ein No-op. pub fn note_raw_reads(spot: &Spot) { - if nur_modus() != NurModus::Roh { - return; - } - let mask = spot.villains.iter().filter(|v| v.profile.is_some() && v.seat < 64).fold(0u64, |m, v| m | 1 << v.seat); + let pass: Box bool> = match nur_modus() { + NurModus::Roh => Box::new(|_| true), + NurModus::Xr(s) => Box::new(move |p| p.check_raise.is_some_and(|x| !x.is_nan() && x < s)), + _ => return, + }; + let mask = spot.villains.iter().filter(|v| v.seat < 64 && v.profile.as_ref().is_some_and(|p| pass(p))).fold(0u64, |m, v| m | 1 << v.seat); ROH.with(|r| r.set(mask)); } @@ -145,7 +151,7 @@ fn tighten_for(villain: &Villain) -> bool { match nur_modus() { NurModus::Alle => true, NurModus::Gelesen => villain.profile.is_some(), - NurModus::Roh => villain.seat < 64 && ROH.with(|r| r.get()) >> villain.seat & 1 == 1, + NurModus::Roh | NurModus::Xr(_) => villain.seat < 64 && ROH.with(|r| r.get()) >> villain.seat & 1 == 1, } }