SOLVER_KERN (aus): River-Entscheidung aus dem Subgame-Solver gegen BETTOR- und Pool-Antworten
Gespielte Linie auf das Live-Range-Modell festgelegt, kuenftige Gegnerknoten auf BETTOR, WETT_KURVE und Pool-Fold gegen Raise; Raise nur fuer Wert; gegen den festgelegten Gegner die reine beste Antwort nach Wert, die im Grund steht. Pflichtfaelle 38/43 (live 35), kein harter Verlierer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,24 @@ pub fn likelihood(street: Street, pfa: bool, before: bool, answer: char) -> Opti
|
||||
table()?.iter().find(|(k, a, _)| *k == (street, pfa, before) && *a == answer).map(|(_, _, lk)| *lk)
|
||||
}
|
||||
|
||||
/// The row for `answer` at this node AS MEASURED (`P(answer | percentile bin)`, not normalized), so the
|
||||
/// answers of one node can be compared with each other (`engine::solver_kern` locks the villain's whole
|
||||
/// open decision to them). `None` without a table or without that row.
|
||||
pub fn raw_likelihood(street: Street, pfa: bool, before: bool, answer: char) -> Option<Likelihood> {
|
||||
use std::sync::OnceLock;
|
||||
static RAW: OnceLock<Option<Vec<(Key, char, Likelihood)>>> = OnceLock::new();
|
||||
RAW.get_or_init(|| {
|
||||
let path = std::env::var("BETTOR").ok().filter(|p| !p.is_empty())?;
|
||||
let text = std::fs::read_to_string(&path).ok()?;
|
||||
let rows: Vec<_> = text.lines().filter_map(parse_raw).collect();
|
||||
(!rows.is_empty()).then_some(rows)
|
||||
})
|
||||
.as_ref()?
|
||||
.iter()
|
||||
.find(|(k, a, _)| *k == (street, pfa, before) && *a == answer)
|
||||
.map(|(_, _, lk)| *lk)
|
||||
}
|
||||
|
||||
/// Acceptance at board percentile `p` (linear between bin centres, flat at the ends).
|
||||
pub fn accept(lk: &Likelihood, p: f64) -> f64 {
|
||||
let x = (p.clamp(0.0, 1.0) * BINS as f64 - 0.5).clamp(0.0, (BINS - 1) as f64);
|
||||
|
||||
@@ -226,6 +226,32 @@ pub fn fold(profile: Option<&Profile>, base: f64, ratio: f64, facing_raise: bool
|
||||
Some(f.clamp(0.0, super::fold_chance::MAX_FOLD))
|
||||
}
|
||||
|
||||
/// Der Pool-Fold am RIVER fuer den Solver-Kern (`engine::solver_kern`): hero setzt mit Druck `ratio` (Topf-Anteile)
|
||||
/// in einen offenen River-Topf; ab `allin_ab` zaehlt die All-in-Kurve in effektiver Groesse. Die Linie kommt aus dem
|
||||
/// Turn wie bei `setze_lage` (hero Aggressor = fort, Gegner = gegner, sonst sonst). Unabhaengig von den
|
||||
/// Strassen-/ungelesen-Optionen der Live-Konfiguration: nur die Tabelle muss lesbar sein. Mit Fold-Read
|
||||
/// (`foldToBet`) verschoben im Logit wie `fold`. `None`: keine Tabelle.
|
||||
pub fn river_pool_fold(spot: &Spot, ratio: f64, allin_ab: f64, profile: Option<&Profile>) -> Option<f64> {
|
||||
let c = cfg()?;
|
||||
let ag = letzter_aggressor(spot, Street::Turn);
|
||||
let linie = if ag == Some(spot.hero_seat) {
|
||||
0
|
||||
} else if ag.is_some() {
|
||||
3
|
||||
} else {
|
||||
1
|
||||
};
|
||||
let ratio = if ratio.is_finite() { ratio.max(0.0) } else { 0.0 };
|
||||
let (linie, r) = if ratio >= allin_ab - 1e-9 { (2, ratio.min(allin_ab)) } else { (linie, ratio) };
|
||||
let pool = interp(&c.kurven[2][linie], r);
|
||||
let read = profile.and_then(|p| p.fold_to_bet).filter(|f| f.is_finite() && *f > 0.0 && *f < 1.0);
|
||||
let f = match read {
|
||||
Some(b) => sigmoid(logit(pool) + logit(b) - logit(c.f_ref)),
|
||||
None => pool,
|
||||
};
|
||||
Some(f.clamp(0.0, super::fold_chance::MAX_FOLD))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user