POOL_PRIOR (aus bitgleich): Pool-Basis fuer ungelesene/gegatete Gegner in read_gate, passive Achsen, verblasst zum Blind-Anker; Pilot verliert (Sim-Gegner folden weniger als der echte Pool), wartet auf pool-nl2-echt. Tore: REST_STACK=streng bestanden, FORTSETZUNG eng:0 ohne gto-Verlierer (volles Tor laeuft), LESE_VERTRAUEN=reg verworfen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 00:26:32 +01:00
co-authored by Claude Opus 5.5
parent f72b59e649
commit 479d142d0c
1562 changed files with 3120781 additions and 115 deletions
+5 -2
View File
@@ -80,8 +80,11 @@ pub fn with_pop_prior_on(
raised: bool,
base: f64,
) -> f64 {
let prior_allowed = !raised || raise_prior_enabled();
let prior = if profile.is_none() && !sustained && prior_allowed {
// A pool baseline (`POOL_PRIOR`) counts as unread; its raises carry the pool's value share.
let pool_value = profile.is_some_and(|p| p.pool_baseline && p.pool_raise_value);
let prior_allowed = !raised || (raise_prior_enabled() && !pool_value);
let unread = profile.is_none_or(|p| p.pool_baseline);
let prior = if unread && !sustained && prior_allowed {
POP_BLUFF_PRIOR[street as usize]
} else {
0.0
+4
View File
@@ -35,6 +35,8 @@ const WEAK_PLAYER: Profile = Profile {
reraise_to_raise: None,
size_gain: None,
fold_only: false,
pool_baseline: false,
pool_raise_value: false,
};
fn prior(mark: &str) -> Option<Profile> {
@@ -74,5 +76,7 @@ pub fn with_mark(measured: Option<Profile>, mark: &str) -> Option<Profile> {
reraise_to_raise: known.reraise_to_raise,
size_gain: known.size_gain,
fold_only: known.fold_only,
pool_baseline: known.pool_baseline,
pool_raise_value: known.pool_raise_value,
})
}
+87
View File
@@ -204,6 +204,73 @@ pub fn pooled(pool: &Pool, p: Option<Profile>) -> Option<Profile> {
Some(out)
}
/// `POOL_PRIOR` (read once; needs `GEGNER_POOL` and a stake): the pool as the baseline of an unread
/// or gated villain in the core (`engine::read_gate`), passive axes only.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct PriorMode {
/// The pool's fold reads, faded by the villain's own sample.
pub fold: bool,
/// Raises carry the pool's value share (no population over-bluff prior on a raise).
pub raise_value: bool,
}
thread_local! {
static PRIOR_OVERRIDE: std::cell::Cell<Option<Option<PriorMode>>> = const { std::cell::Cell::new(None) };
}
/// `POOL_PRIOR=passiv`: fold reads and raise value; `fold` / `raise`: one of them. Else off.
pub fn prior_mode() -> Option<PriorMode> {
static M: std::sync::OnceLock<Option<PriorMode>> = std::sync::OnceLock::new();
PRIOR_OVERRIDE.with(|o| o.get()).unwrap_or_else(|| {
*M.get_or_init(|| match std::env::var("POOL_PRIOR").as_deref() {
Ok("passiv") => Some(PriorMode { fold: true, raise_value: true }),
Ok("fold") => Some(PriorMode { fold: true, raise_value: false }),
Ok("raise") => Some(PriorMode { fold: false, raise_value: true }),
_ => None,
})
})
}
/// Force `POOL_PRIOR` on this thread (`Some(None)` = off), `None` = the environment. Tests only.
pub fn set_prior_override(mode: Option<Option<PriorMode>>) {
PRIOR_OVERRIDE.with(|o| o.set(mode));
}
/// The pool baseline for an unread or gated villain (`raw` = his ungated profile, if any), or `None`
/// (blind as before) for an aggressor (guard) or when nothing would change.
///
/// * **Fold reads:** `anchor + (1 - c) (mu - anchor)` per proven pool read, `c` the villain's own
/// confidence. Unread he plays like the stake's pool; as his sample grows the baseline fades back to
/// the core's blind anchor, since his own read stays gated (an untrusted style). It never becomes his
/// own fold read (`ANGRIFF_FOLD` lost −330 bb/100 against nemesis-1 that way).
/// * **Raise value:** the micro pool raises for value (checkRaise 0.052 at NL2, live 14.11. 12 of 13
/// raises continued, −391 BB), so a raise gets no population over-bluff prior, unless his own
/// raise-facing-a-bet read (Bayes, anchor `RAISE_TO_BET_POOL`) is wider than the anchor.
pub fn baseline(pool: &Pool, raw: Option<&Profile>, mode: PriorMode) -> Option<Profile> {
if raw.is_some_and(aggressor) {
return None;
}
let c = raw.and_then(|p| p.confidence).filter(|c| c.is_finite()).unwrap_or(0.0).clamp(0.0, 1.0);
let mut out = Profile { pool_baseline: true, ..Profile::default() };
if mode.fold {
let fade = |name: &str, anchor: f64| pool.get(name).map(|r| (anchor + (1.0 - c) * (r.mu - anchor)).clamp(0.0, 1.0));
out.fold_to_bet = fade("foldToBet", DEFAULT_FOLD_TO_BET);
out.fold_to_cbet = fade("foldToCbet", DEFAULT_FOLD_TO_BET);
out.street_fold_to_bet = [fade("flopFoldToBet", DEFAULT_FOLD_TO_BET), fade("turnFoldToBet", DEFAULT_FOLD_TO_BET), fade("riverFoldToBet", DEFAULT_FOLD_TO_BET)];
out.fold_to_three_bet = fade("foldToThreeBet", FOLD_TO_THREE_BET_ANCHOR);
out.fold_to_steal = fade("foldToSteal", 0.65);
}
if mode.raise_value {
let wide = raw
.and_then(|p| p.raise_to_bet)
.filter(|r| r.is_finite())
.is_some_and(|r| r > crate::exploit::street_continuation::RAISE_TO_BET_POOL);
out.pool_raise_value = !wide;
}
let empty = Profile { pool_baseline: true, ..Profile::default() };
(out != empty).then_some(out)
}
#[cfg(test)]
mod tests {
use super::*;
@@ -237,6 +304,26 @@ mod tests {
assert!(from_table(&t, "uebung").reads.is_empty(), "play money never enters the cash pool");
}
#[test]
fn the_baseline_fades_to_the_anchor_and_guards_the_aggressor() {
let pool = from_table(&table(), "NL0.01-0.02");
let both = PriorMode { fold: true, raise_value: true };
let unread = baseline(&pool, None, both).unwrap();
assert_eq!(unread.fold_to_bet, Some(0.55));
assert!(unread.pool_baseline && unread.pool_raise_value);
assert_eq!(crate::exploit::style::classify(&unread), crate::exploit::style::Style::Unknown);
let half = Profile { fold_to_bet: Some(0.80), confidence: Some(0.5), ..Profile::default() };
let b = baseline(&pool, Some(&half), both).unwrap();
assert!((b.fold_to_bet.unwrap() - (DEFAULT_FOLD_TO_BET + 0.5 * 0.10)).abs() < 1e-12, "own read stays gated");
let wide = Profile { raise_to_bet: Some(0.45), ..half };
assert!(!baseline(&pool, Some(&wide), both).unwrap().pool_raise_value);
let maniac = Profile { aggression: Some(0.7), aggression_confidence: Some(0.5), ..half };
assert_eq!(baseline(&pool, Some(&maniac), both), None);
let only_fold = PriorMode { fold: true, raise_value: false };
assert!(!baseline(&pool, None, only_fold).unwrap().pool_raise_value);
assert_eq!(baseline(&Pool::default(), None, only_fold), None);
}
#[test]
fn only_proven_passive_reads_enter() {
let pool = from_table(&table(), "NL0.01-0.02");
+117 -109
View File
@@ -1,109 +1,117 @@
/// Observed opponent tendencies, all frequencies in `[0, 1]`. Every field optional.
/// Wire shape (extension):
/// `"profile": {"vpip": 0.45, "pfr": 0.08, "foldToBet": 0.3, "aggression": 0.4}`.
///
/// The fields below `aggression` are the HUD numbers the client already delivers but the core did
/// not read before (`lesen/profil.py` DURCHGEREICHT). They carry their client names on the wire
/// (`src/wire/decode_villain.rs`) and reach the engine per villain. No exploit rule reads them yet:
/// every new read must first earn its place on the ladder benchmark (`read_gate`), which no
/// candidate has so far. They stand ready for the opponent memory and future, ladder-proven rules.
#[derive(Clone, Copy, Debug, PartialEq, Default)]
pub struct Profile {
/// Voluntarily put money in pot, preflop.
pub vpip: Option<f64>,
/// Preflop raise frequency.
pub pfr: Option<f64>,
/// How often the player folds to a bet postflop.
pub fold_to_bet: Option<f64>,
/// Share of the player's postflop actions that are bets or raises (aggression
/// frequency). Steers how much of their betting range is a bluff (`bluff_share`).
pub aggression: Option<f64>,
/// Aggression frequency on the TURN only (bets+raises over the player's turn actions). `None`
/// until the memory/HUD has turn data. The turn gearbox (`engine::turn_subgame`) prefers it over
/// the pooled `aggression`: a player who barrels turns but checks flops reads as a turn bluffer
/// here, so the defensive veto does not fold a good call against them.
pub turn_aggression: Option<f64>,
/// Aggression frequency on the RIVER only. `None` until the memory/HUD has river data. The river
/// gearbox (`engine::river_subgame`) prefers it over the pooled `aggression`, since river bluffing
/// tendency differs from flop/turn barreling.
pub river_aggression: Option<f64>,
/// Fold-to-bet split by street `[flop, turn, river]`, already shrunk toward the pooled
/// `fold_to_bet` by the street's own sample size (`sim::memory`), so a thin street stays at the
/// pooled read and a well-sampled one moves to its own rate. `None` per street = no data. Read
/// only by `fold_chance::fold_chance_on` (hero's fold equity on that street).
pub street_fold_to_bet: [Option<f64>; 3],
/// How often the player continuation-bets the flop as the preflop aggressor.
pub cbet: Option<f64>,
/// How often the player folds to a continuation bet.
pub fold_to_cbet: Option<f64>,
/// Preflop three-bet frequency.
pub three_bet: Option<f64>,
/// How often the player folds to a three-bet.
pub fold_to_three_bet: Option<f64>,
/// How often the player attempts to steal the blinds from late position.
pub steal: Option<f64>,
/// How often the player check-raises.
pub check_raise: Option<f64>,
/// Went to showdown: how often the player reaches showdown once seeing the flop. A high
/// value marks a sticky, showdown-happy opponent.
pub wtsd: Option<f64>,
/// Won at showdown: how often the player wins once at showdown.
pub wsd: Option<f64>,
/// Confidence in this read, in `[0, 1)`: 0 without data, rising with the observed postflop
/// sample (half at `sim::memory::CONFIDENCE_HALF` actions). Not a tendency — it says how far the
/// read may be trusted. The river gearbox (`engine::river_subgame`) turns it into the KL trust
/// radius λ: strong read → exploit far, weak read → stay near GTO. `None` = no confidence signal
/// (treated as 0 by the gearbox). No classify/gate rule reads it; it only scales exploitation.
pub confidence: Option<f64>,
/// Confidence of the AGGRESSION read alone, in `[0, 1)`. Live the client HUD has no aggression:
/// it comes from the few postflop moves this session saw (`lesen/profil.py`), while `confidence`
/// comes from the HUD hand count, so the two can disagree by orders of magnitude (500 HUD hands,
/// 2 seen moves). `None` = the aggression read is as good as `confidence` (the session memory,
/// where both come from the same postflop sample). Read through `bluff_read_confidence`.
pub aggression_confidence: Option<f64>,
/// River showdown read: of the player's river bets/raises that were SHOWN DOWN, the share that was
/// air (equity below `AIR_STRENGTH` vs a random hand on the final board). Unbiased evidence of the
/// river betting range: whether hero calls depends on hero's cards, not the bettor's. The river
/// gearbox blends it into its bluff belief by `river_bluff_shown` (`engine::river_subgame`).
pub river_bluff_share: Option<f64>,
/// How many river bets/raises `river_bluff_share` rests on.
pub river_bluff_shown: Option<f64>,
/// Aggression frequency on the FLOP only (memory handover `reads.flopAggression`). `None` without it.
pub flop_aggression: Option<f64>,
/// How often the player, in a blind, folds to a steal raise (`reads.foldToSteal`).
pub fold_to_steal: Option<f64>,
/// How often the player folds after betting/raising a postflop street and being raised (`reads.foldToRaise`).
pub fold_to_raise: Option<f64>,
/// How often the player RAISES when facing a postflop bet (raises over folds + calls + raises facing
/// a bet). Sim memory only so far (`RERAISE_TIEFE` gate); `None` without it.
pub raise_to_bet: Option<f64>,
/// How often the player RE-RAISES when raised after their own postflop bet/raise on that street
/// (aggressive over fold + call + aggressive in that spot). Drives the `RERAISE_TIEFE` narrowing
/// per raise level; `None` without it (pool value).
pub reraise_to_raise: Option<f64>,
/// How strongly the player's bet size tells their strength, as a gain on the population's
/// size notch (`exploit::size_notch`): 1 = the population (bigger is stronger, as assumed), 0 = no
/// tell, negative = reverse sizing, 2 = a pure value-sizer. From the shown (size, strength) pairs,
/// shrunk toward 1. Sim memory only so far; used under `GROESSE_LESEN=1`.
pub size_gain: Option<f64>,
/// Set by `engine::read_gate` (switch `ANGRIFF_FOLD`) on the reduced profile of an untrusted style:
/// only the fold reads were kept, so the profile has no style (`exploit::style::classify` =
/// Unknown) and only the fold chance of hero's bets uses it. Never on the wire.
pub fold_only: bool,
}
/// Equity vs a random hand on the river below which a shown river bet counts as air (a bluff): the
/// lower two strength bands (`sim::welt_memory::STRENGTH_BANDS`).
pub const AIR_STRENGTH: f64 = 0.4;
impl Profile {
/// How far a read about this player's BLUFFING may be trusted: the weaker of the overall read
/// and the aggression read. `None` = no confidence signal (the gearbox treats it as 0).
pub fn bluff_read_confidence(&self) -> Option<f64> {
let ok = |x: Option<f64>| x.filter(|c| !c.is_nan());
match (ok(self.confidence), ok(self.aggression_confidence)) {
(Some(c), Some(a)) => Some(c.min(a)),
(c, _) => c,
}
}
}
/// Observed opponent tendencies, all frequencies in `[0, 1]`. Every field optional.
/// Wire shape (extension):
/// `"profile": {"vpip": 0.45, "pfr": 0.08, "foldToBet": 0.3, "aggression": 0.4}`.
///
/// The fields below `aggression` are the HUD numbers the client already delivers but the core did
/// not read before (`lesen/profil.py` DURCHGEREICHT). They carry their client names on the wire
/// (`src/wire/decode_villain.rs`) and reach the engine per villain. No exploit rule reads them yet:
/// every new read must first earn its place on the ladder benchmark (`read_gate`), which no
/// candidate has so far. They stand ready for the opponent memory and future, ladder-proven rules.
#[derive(Clone, Copy, Debug, PartialEq, Default)]
pub struct Profile {
/// Voluntarily put money in pot, preflop.
pub vpip: Option<f64>,
/// Preflop raise frequency.
pub pfr: Option<f64>,
/// How often the player folds to a bet postflop.
pub fold_to_bet: Option<f64>,
/// Share of the player's postflop actions that are bets or raises (aggression
/// frequency). Steers how much of their betting range is a bluff (`bluff_share`).
pub aggression: Option<f64>,
/// Aggression frequency on the TURN only (bets+raises over the player's turn actions). `None`
/// until the memory/HUD has turn data. The turn gearbox (`engine::turn_subgame`) prefers it over
/// the pooled `aggression`: a player who barrels turns but checks flops reads as a turn bluffer
/// here, so the defensive veto does not fold a good call against them.
pub turn_aggression: Option<f64>,
/// Aggression frequency on the RIVER only. `None` until the memory/HUD has river data. The river
/// gearbox (`engine::river_subgame`) prefers it over the pooled `aggression`, since river bluffing
/// tendency differs from flop/turn barreling.
pub river_aggression: Option<f64>,
/// Fold-to-bet split by street `[flop, turn, river]`, already shrunk toward the pooled
/// `fold_to_bet` by the street's own sample size (`sim::memory`), so a thin street stays at the
/// pooled read and a well-sampled one moves to its own rate. `None` per street = no data. Read
/// only by `fold_chance::fold_chance_on` (hero's fold equity on that street).
pub street_fold_to_bet: [Option<f64>; 3],
/// How often the player continuation-bets the flop as the preflop aggressor.
pub cbet: Option<f64>,
/// How often the player folds to a continuation bet.
pub fold_to_cbet: Option<f64>,
/// Preflop three-bet frequency.
pub three_bet: Option<f64>,
/// How often the player folds to a three-bet.
pub fold_to_three_bet: Option<f64>,
/// How often the player attempts to steal the blinds from late position.
pub steal: Option<f64>,
/// How often the player check-raises.
pub check_raise: Option<f64>,
/// Went to showdown: how often the player reaches showdown once seeing the flop. A high
/// value marks a sticky, showdown-happy opponent.
pub wtsd: Option<f64>,
/// Won at showdown: how often the player wins once at showdown.
pub wsd: Option<f64>,
/// Confidence in this read, in `[0, 1)`: 0 without data, rising with the observed postflop
/// sample (half at `sim::memory::CONFIDENCE_HALF` actions). Not a tendency — it says how far the
/// read may be trusted. The river gearbox (`engine::river_subgame`) turns it into the KL trust
/// radius λ: strong read → exploit far, weak read → stay near GTO. `None` = no confidence signal
/// (treated as 0 by the gearbox). No classify/gate rule reads it; it only scales exploitation.
pub confidence: Option<f64>,
/// Confidence of the AGGRESSION read alone, in `[0, 1)`. Live the client HUD has no aggression:
/// it comes from the few postflop moves this session saw (`lesen/profil.py`), while `confidence`
/// comes from the HUD hand count, so the two can disagree by orders of magnitude (500 HUD hands,
/// 2 seen moves). `None` = the aggression read is as good as `confidence` (the session memory,
/// where both come from the same postflop sample). Read through `bluff_read_confidence`.
pub aggression_confidence: Option<f64>,
/// River showdown read: of the player's river bets/raises that were SHOWN DOWN, the share that was
/// air (equity below `AIR_STRENGTH` vs a random hand on the final board). Unbiased evidence of the
/// river betting range: whether hero calls depends on hero's cards, not the bettor's. The river
/// gearbox blends it into its bluff belief by `river_bluff_shown` (`engine::river_subgame`).
pub river_bluff_share: Option<f64>,
/// How many river bets/raises `river_bluff_share` rests on.
pub river_bluff_shown: Option<f64>,
/// Aggression frequency on the FLOP only (memory handover `reads.flopAggression`). `None` without it.
pub flop_aggression: Option<f64>,
/// How often the player, in a blind, folds to a steal raise (`reads.foldToSteal`).
pub fold_to_steal: Option<f64>,
/// How often the player folds after betting/raising a postflop street and being raised (`reads.foldToRaise`).
pub fold_to_raise: Option<f64>,
/// How often the player RAISES when facing a postflop bet (raises over folds + calls + raises facing
/// a bet). Sim memory only so far (`RERAISE_TIEFE` gate); `None` without it.
pub raise_to_bet: Option<f64>,
/// How often the player RE-RAISES when raised after their own postflop bet/raise on that street
/// (aggressive over fold + call + aggressive in that spot). Drives the `RERAISE_TIEFE` narrowing
/// per raise level; `None` without it (pool value).
pub reraise_to_raise: Option<f64>,
/// How strongly the player's bet size tells their strength, as a gain on the population's
/// size notch (`exploit::size_notch`): 1 = the population (bigger is stronger, as assumed), 0 = no
/// tell, negative = reverse sizing, 2 = a pure value-sizer. From the shown (size, strength) pairs,
/// shrunk toward 1. Sim memory only so far; used under `GROESSE_LESEN=1`.
pub size_gain: Option<f64>,
/// Set by `engine::read_gate` (switch `ANGRIFF_FOLD`) on the reduced profile of an untrusted style:
/// only the fold reads were kept, so the profile has no style (`exploit::style::classify` =
/// Unknown) and only the fold chance of hero's bets uses it. Never on the wire.
pub fold_only: bool,
/// Set by `engine::read_gate` (switch `POOL_PRIOR`) on the stake's pool baseline of an unread or
/// gated villain: only the pool's passive fold reads, faded by the villain's own sample. No style
/// (`classify` = Unknown); the bet over-bluff prior of an unread villain still applies
/// (`exploit::bluff_share`). Never on the wire.
pub pool_baseline: bool,
/// With `pool_baseline`: the villain's raises carry the pool's value share (no population
/// over-bluff prior on a raise), because his own raise read is not wider than the anchor.
pub pool_raise_value: bool,
}
/// Equity vs a random hand on the river below which a shown river bet counts as air (a bluff): the
/// lower two strength bands (`sim::welt_memory::STRENGTH_BANDS`).
pub const AIR_STRENGTH: f64 = 0.4;
impl Profile {
/// How far a read about this player's BLUFFING may be trusted: the weaker of the overall read
/// and the aggression read. `None` = no confidence signal (the gearbox treats it as 0).
pub fn bluff_read_confidence(&self) -> Option<f64> {
let ok = |x: Option<f64>| x.filter(|c| !c.is_nan());
match (ok(self.confidence), ok(self.aggression_confidence)) {
(Some(c), Some(a)) => Some(c.min(a)),
(c, _) => c,
}
}
}
+4
View File
@@ -46,6 +46,8 @@ pub const PRIOR: Profile = Profile {
reraise_to_raise: None,
size_gain: None,
fold_only: false,
pool_baseline: false,
pool_raise_value: false,
};
/// Postflop moves at which an aggression read and the population weigh the same — the session
@@ -101,6 +103,8 @@ pub fn shrink(profile: &Profile, hands: f64) -> Profile {
reraise_to_raise: profile.reraise_to_raise,
size_gain: profile.size_gain,
fold_only: profile.fold_only,
pool_baseline: profile.pool_baseline,
pool_raise_value: profile.pool_raise_value,
}
}
+1 -1
View File
@@ -134,7 +134,7 @@ pub fn classify_with(profile: &Profile, station_gate: bool) -> Style {
let tight = vpip.is_some_and(|v| v <= NIT_VPIP)
|| (fold.is_some_and(|b| b >= NIT_FOLD_TO_BET)
&& vpip.is_none_or(|v| v <= NIT_MAX_VPIP_WITH_FOLDS));
if profile.fold_only || (vpip.is_none() && pfr.is_none() && fold.is_none()) {
if profile.fold_only || profile.pool_baseline || (vpip.is_none() && pfr.is_none() && fold.is_none()) {
Style::Unknown
} else if loose && pfr.is_some_and(|f| f >= AGGRESSIVE_PFR) {
Style::LooseAggressive