D2 Leiter: GEDAECHTNIS_FOLD=a,b - foldToBet im Sim-Gedaechtnis wie decode_villain profile.reads (nur LESEN_DRAHT=gezaehlt)

Arm A = Anker des Kerns ohne prior (13.5,16.5 = 0.45@30), Arm B = D2-Stake-Prior Micro.
Ohne gezaehlt oder ohne Wert bitgleich (Rauchtest reg/fish 60 Deals: Dateien identisch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 01:01:40 +01:00
co-authored by Claude Opus 5.5
parent dc50668ec4
commit 04a17c791a
2 changed files with 33 additions and 1 deletions
+5
View File
@@ -54,6 +54,11 @@ fn apply_arm() {
_ => WireRead::Off,
});
}
// GEDAECHTNIS_FOLD=a,b: foldToBet as the memory handover decodes it (plan D2), only with LESEN_DRAHT=gezaehlt.
rechner::sim::memory::set_fold_prior(std::env::var("GEDAECHTNIS_FOLD").ok().and_then(|v| {
let mut it = v.split(',').map(|x| x.trim().parse::<f64>().ok());
Some((it.next()??, it.next()??))
}));
// READS=cbet,3bet,xr: the line-specific HUD reads (fold to c-bet / fold to 3-bet / check-raise).
use rechner::sim::memory::{set_line_reads, READ_CBET, READ_CHECK_RAISE, READ_THREE_BET};
let reads = std::env::var("READS").unwrap_or_default();
+28 -1
View File
@@ -155,6 +155,27 @@ fn wire_read() -> WireRead {
}
}
/// Memory handover foldToBet (plan D2, gedaechtnis-voll): with `Counted`, the pooled fold-to-bet is the
/// posterior `(k + a) / (n + a + b)` over the true facing-bet counts, exactly as `wire::decode_villain`
/// decodes `profile.reads.foldToBet {n, k, prior: [a, b]}`. Without a delivered prior live decodes the
/// core's anchor at 30 chances (a = 0.45 * 30, b = 0.55 * 30): that is the A arm, the D2 stake prior the
/// B arm. Unset (both 0): the `shrink` path as before (bit-identical).
static FOLD_PRIOR_A: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
static FOLD_PRIOR_B: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
/// Set (`Some((a, b))`, both > 0) or clear the memory-handover foldToBet prior (see above).
pub fn set_fold_prior(prior: Option<(f64, f64)>) {
let (a, b) = prior.filter(|(a, b)| *a > 0.0 && *b > 0.0).unwrap_or((0.0, 0.0));
FOLD_PRIOR_A.store(a.to_bits(), std::sync::atomic::Ordering::Relaxed);
FOLD_PRIOR_B.store(b.to_bits(), std::sync::atomic::Ordering::Relaxed);
}
fn fold_prior() -> Option<(f64, f64)> {
let a = f64::from_bits(FOLD_PRIOR_A.load(std::sync::atomic::Ordering::Relaxed));
let b = f64::from_bits(FOLD_PRIOR_B.load(std::sync::atomic::Ordering::Relaxed));
(a > 0.0 && b > 0.0).then_some((a, b))
}
/// The read a HUD accumulates from watching one fixed opponent archetype play a session.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct SessionMemory {
@@ -379,7 +400,13 @@ impl SessionMemory {
..raw
};
let pooled = shrink(&base, cap(self.c.hands, HUD_HANDS));
let pooled = shrink_aggression(pooled, raw.aggression, cap(postflop_actions, HUD_MOVES));
let mut pooled = shrink_aggression(pooled, raw.aggression, cap(postflop_actions, HUD_MOVES));
if let (WireRead::Counted, Some((a, b))) = (mode, fold_prior()) {
let n = (self.c.folded_to_bet + self.c.passive_call) as f64;
if n > 0.0 {
pooled.fold_to_bet = Some(((self.c.folded_to_bet as f64 + a) / (n + a + b)).clamp(0.0, 1.0));
}
}
let rate = |k: u32, n: u32| (n > 0).then(|| k as f64 / n as f64);
let street = |k: u32, n: u32, anchor: Option<f64>| shrink_street(rate(k, n), cap(n, HUD_STREET), anchor);
let (ta, tn) = (self.c.turn_aggressive, self.c.turn_aggressive + self.c.turn_passive);