POSTERIOR S2: Prior = c * Heuristik aus dem UNGEGATETEN Aggressions-Read + (1-c) * Linie/Pool, c = Bluff-Read-Vertrauen (0 ohne Aggressions-Read); Showdowns aus dem Rohprofil

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 13:37:41 +01:00
co-authored by Claude Opus 5.5
parent 351716477b
commit 71a26f01cd
3 changed files with 40 additions and 42 deletions
+38 -40
View File
@@ -25,7 +25,7 @@
use crate::card::{deck, Card};
use super::glaube_linie::{self, Line};
use crate::exploit::bluff_share::MAX_BLUFF_SHARE;
use crate::exploit::bluff_share::{bluff_share, MAX_BLUFF_SHARE};
use crate::exploit::call_floor::CALL_RUNG;
use crate::exploit::profile::Profile;
use crate::exploit::sample::STREET_PRIOR;
@@ -70,30 +70,19 @@ pub struct Mode {
thread_local! {
static OVERRIDE: std::cell::Cell<Option<Option<Mode>>> = const { std::cell::Cell::new(None) };
static MASS: RefCell<HashMap<String, f64>> = RefCell::new(HashMap::new());
/// Shown river bets per seat of the UNGATED spot of the current decision (`note_shown`).
static SHOWN: RefCell<Vec<(u8, f64, f64)>> = const { RefCell::new(Vec::new()) };
/// The UNGATED profile per seat of the current decision (`note_raw`).
static RAW: RefCell<Vec<(u8, Profile)>> = const { RefCell::new(Vec::new()) };
}
/// Called by `engine::read_gate::gate_reads` with the raw spot: keeps every villain's shown river
/// bets (`Profile::river_bluff_share` over `river_bluff_shown`) for `bluff`, because the gate drops a
/// non-station profile and with it the showdowns. Only under S2; else nothing is kept.
pub fn note_shown(raw: &Spot) {
/// Called by `engine::read_gate::gate_reads` with the raw spot: keeps every villain's ungated profile
/// for `bluff`, because the gate drops a non-station profile and with it the aggression read and the
/// showdowns that tell a bluffer from a value bettor. Only under S2; else nothing is kept.
pub fn note_raw(raw: &Spot) {
if !mode().is_some_and(|m| m.bluff) {
return;
}
let ok = |x: Option<f64>| x.filter(|v| v.is_finite());
let shown: Vec<(u8, f64, f64)> = raw
.villains
.iter()
.filter_map(|v| {
let p = v.profile.as_ref()?;
match (ok(p.river_bluff_share), ok(p.river_bluff_shown)) {
(Some(s), Some(n)) if n > 0.0 => Some((v.seat, s.clamp(0.0, 1.0), n)),
_ => None,
}
})
.collect();
SHOWN.with(|x| *x.borrow_mut() = shown);
let kept: Vec<(u8, Profile)> = raw.villains.iter().filter_map(|v| v.profile.map(|p| (v.seat, p))).collect();
RAW.with(|x| *x.borrow_mut() = kept);
}
/// `POSTERIOR=fold` or `fold:<w>` (comma list of stages; unknown stages are ignored). Else off.
@@ -273,40 +262,49 @@ fn class_fold(f: f64, m_board: f64, m_ref: f64) -> f64 {
}
}
/// S2: the bluff share of a villain's bet as a Beta posterior.
/// S2: the bluff share of a villain's bet as a Beta posterior over one continuous read instead of
/// the gate's all-or-nothing.
///
/// * Prior of an UNREAD villain (no profile or the pool baseline): the population's air share on
/// this betting `line` (`engine::glaube_linie`, real showdowns per street, pot, barrels, size,
/// kind), `(air + 0,5)/(n + 1)`. Without a line table: on the river the pool mean `POOL_RIVER_AIR`
/// (never above the heuristic), on flop and turn the heuristic.
/// * Prior of a READ villain: the heuristic from his aggression (`exploit::bluff_share`).
/// * Evidence: his shown river bets (`Profile::river_bluff_share` over `river_bluff_shown`, also when
/// the gate dropped his profile: `note_shown`), weight
/// of the prior `STREET_PRIOR` bets as in the solver's read; flop and turn have no per-street
/// showdown count yet.
/// * Population part: the air share on this betting `line` (`engine::glaube_linie`, real showdowns
/// per street, pot, barrels, size, kind), `(air + 0,5)/(n + 1)`. Without a line table: on the river
/// the pool mean `POOL_RIVER_AIR` (never above `prior`), on flop and turn `prior` (the heuristic
/// with the population over-bluff prior).
/// * Read part: the heuristic from his UNGATED aggression (`exploit::bluff_share` on the raw profile,
/// `note_raw`), so a bluffer the gate blinded still counts as one.
/// * Prior = c · read + (1 − c) · population, c = the raw `Profile::bluff_read_confidence`; 0 without
/// an aggression read (a HUD profile with only a hand count does not tell bluffs).
/// * Evidence: his shown river bets (`river_bluff_share` over `river_bluff_shown`), the prior worth
/// `STREET_PRIOR` bets as in the solver's read.
///
/// Off: `prior` unchanged.
pub fn bluff(seat: u8, profile: Option<&Profile>, street: Street, line: Option<&Line>, prior: f64) -> f64 {
pub fn bluff(seat: u8, street: Street, ratio: Option<f64>, line: Option<&Line>, prior: f64) -> f64 {
if !mode().is_some_and(|m| m.bluff) || street == Street::Preflop {
return prior;
}
let ok = |x: Option<f64>| x.filter(|v| v.is_finite());
let unread = profile.is_none_or(|p| p.pool_baseline);
let pool = line.and_then(glaube_linie::lookup).map(|(air, n)| (air + 0.5) / (n + 1.0));
let prior = match (unread, pool) {
(true, Some(m)) => m.min(MAX_BLUFF_SHARE),
(true, None) if street == Street::River => prior.min(POOL_RIVER_AIR),
_ => prior,
let raw = RAW.with(|x| x.borrow().iter().find(|(s, _)| *s == seat).map(|(_, p)| *p));
let population = match line.and_then(glaube_linie::lookup) {
Some((air, n)) => ((air + 0.5) / (n + 1.0)).min(MAX_BLUFF_SHARE),
None if street == Street::River => prior.min(POOL_RIVER_AIR),
None => prior,
};
// Only an actual aggression read tells bluffs: a HUD profile without one (hand count only) is unread here.
let c = raw
.as_ref()
.filter(|p| ok(p.aggression).is_some())
.and_then(Profile::bluff_read_confidence)
.filter(|c| c.is_finite())
.unwrap_or(0.0)
.clamp(0.0, 1.0);
let read = raw.as_ref().map_or(population, |p| bluff_share(Some(p), ratio, street));
let prior = c * read + (1.0 - c) * population;
if street != Street::River {
return prior;
}
// His own showdowns: from the profile, else from the ungated spot (the gate dropped the profile).
let own = profile.and_then(|p| match (ok(p.river_bluff_share), ok(p.river_bluff_shown)) {
let own = raw.and_then(|p| match (ok(p.river_bluff_share), ok(p.river_bluff_shown)) {
(Some(share), Some(n)) if n > 0.0 => Some((share.clamp(0.0, 1.0), n)),
_ => None,
});
let own = own.or_else(|| SHOWN.with(|x| x.borrow().iter().find(|(s, _, _)| *s == seat).map(|(_, a, n)| (*a, *n))));
match own {
Some((share, n)) => beta_mean(prior, STREET_PRIOR, share, n).min(MAX_BLUFF_SHARE),
None => prior,
+1 -1
View File
@@ -79,7 +79,7 @@ pub fn exploit_worthy(style: Style) -> bool {
/// `POOL_PRIOR` (off = bit-identical): a villain left blind gets the stake's pool baseline instead
/// (`exploit::pool::baseline`): passive axes only, faded by his own sample, never for an aggressor.
pub fn gate_reads(spot: &Spot) -> Spot {
super::glaube::note_shown(spot);
super::glaube::note_raw(spot);
let pool = crate::exploit::pool::prior_mode()
.and_then(|m| crate::exploit::pool::pool_for(spot.big_blind).map(|p| (p, m)));
let villains = spot
+1 -1
View File
@@ -261,7 +261,7 @@ fn on_street(
.flatten();
let bluff = with_pop_prior_on(villain.profile.as_ref(), street, sustained, lvl == 1, bluff);
let line = crate::engine::glaube_linie::line_of(spot, villain.seat, street, ratio, lvl == 1);
let bluff = crate::engine::glaube::bluff(villain.seat, villain.profile.as_ref(), street, line.as_ref(), bluff);
let bluff = crate::engine::glaube::bluff(villain.seat, street, ratio, line.as_ref(), bluff);
let base = [BET_RUNG, RAISE_RUNG][lvl][slot];
(
rung(base, read_notch(villain, ratio) + style_rung(villain)),