Flussleck: zwei River-Fehler aus dem Live-Lauf 16.11. abends im Kern behoben (Schalter, aus = bitgleich)
RUF_ALLIN=1: called_equity simuliert die All-in-Groesse mit, die REST_STACK hinzufuegt (vorher fiel der Call-Anteil des Jams auf den Anteil gegen die ganze Range zurueck, 0,678). RUF_OBEN=river: am River zahlt die staerkste (1-Fold)-Spitze statt Boden plus Zufall. WERT_BRETT=river: River-Boden der Wett-Range als Staerke-Perzentil auf dem echten Brett (exploit/brett_floor.rs) statt Handklasse; Vierflush-Brett: Strasse 0,35 -> 0,16 Equity. Pflichtfaelle: Live 10/16, Kandidat 12/16, 178854100443 CHECK und 178870300411 FOLD behoben, kein alter Fall verloren. BEKANNTE_SCHALTER ergaenzt. Volles Tor fl-* laeuft gg. ps2-*-an. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
//! Board-relative river floor (`WERT_BRETT=river`): a river bet claims the same RELATIVE strength on
|
||||
//! every board.
|
||||
//!
|
||||
//! The continuation floors of `street_continuation` are absolute made classes (a river bet keeps top
|
||||
//! pair good kicker or better). On a dry board that is roughly the top fifth of all holdings; on a
|
||||
//! paired four-flush board every pocket pair and every hand with a board rank "is" two pair or trips,
|
||||
//! and every club is a flush, so the same class admits most of the deck and a straight looks like 56 %
|
||||
//! against a passive river bettor (live 16.11. hand 178870300411, J-high straight on 9c9hTc8c2c).
|
||||
//!
|
||||
//! The floor is translated through its REFERENCE SHARE: the average share of all two-card holdings at
|
||||
//! or above that class over random river boards. On the actual board the floor rises to the weakest
|
||||
//! class whose share of all holdings does not exceed the reference share. On a dry board nothing
|
||||
//! moves; on a flush or paired board the floor climbs to flushes and full houses. Hold'em only.
|
||||
|
||||
use crate::card::{deck, Card};
|
||||
use crate::hand::showdown::judge;
|
||||
use crate::hand::strength::Strength;
|
||||
use crate::read::glance::glance;
|
||||
use crate::read::made::Made;
|
||||
use crate::rng::Rng;
|
||||
use crate::variant::rules::Rules;
|
||||
|
||||
/// Every class, weakest first (`Made` is ordered).
|
||||
const ALL: [Made; 16] = [
|
||||
Made::Air,
|
||||
Made::BoardOnly,
|
||||
Made::Underpair,
|
||||
Made::BottomPair,
|
||||
Made::MiddlePair,
|
||||
Made::TopPairWeakKicker,
|
||||
Made::TopPairGoodKicker,
|
||||
Made::Overpair,
|
||||
Made::TwoPair,
|
||||
Made::Set,
|
||||
Made::Trips,
|
||||
Made::Straight,
|
||||
Made::Flush,
|
||||
Made::FullHouse,
|
||||
Made::Quads,
|
||||
Made::StraightFlush,
|
||||
];
|
||||
|
||||
/// Random river boards behind the reference shares (fixed seed: deterministic per binary).
|
||||
const REFERENCE_BOARDS: usize = 160;
|
||||
const REFERENCE_SEED: u64 = 0xB0A2_D5EE_D001;
|
||||
|
||||
/// Messschalter (einmal gelesen) `WERT_BRETT=river`: river bet/raise floors are board-relative.
|
||||
pub fn enabled() -> bool {
|
||||
use std::sync::OnceLock;
|
||||
static ON: OnceLock<bool> = OnceLock::new();
|
||||
*ON.get_or_init(|| std::env::var("WERT_BRETT").as_deref() == Ok("river"))
|
||||
}
|
||||
|
||||
/// Share of all two-card holdings (outside the board) per class at or above it: `out[i]` for `ALL[i]`.
|
||||
fn shares_at_least(rules: &Rules, board: &[Card]) -> Option<[f64; 16]> {
|
||||
if rules.hole_cards != 2 {
|
||||
return None;
|
||||
}
|
||||
let pool = deck::without_in(rules.deck, board);
|
||||
let mut count = [0usize; 16];
|
||||
let mut total = 0usize;
|
||||
for i in 0..pool.len() {
|
||||
for j in i + 1..pool.len() {
|
||||
let Ok((made, _)) = glance(rules, &[pool[i], pool[j]], board) else { continue };
|
||||
total += 1;
|
||||
count[ALL.iter().position(|m| *m == made)?] += 1;
|
||||
}
|
||||
}
|
||||
if total == 0 {
|
||||
return None;
|
||||
}
|
||||
let mut out = [0.0; 16];
|
||||
let mut acc = 0usize;
|
||||
for i in (0..16).rev() {
|
||||
acc += count[i];
|
||||
out[i] = acc as f64 / total as f64;
|
||||
}
|
||||
Some(out)
|
||||
}
|
||||
|
||||
/// Average `shares_at_least` over random river boards (Hold'em), computed once.
|
||||
fn reference(rules: &Rules) -> Option<&'static [f64; 16]> {
|
||||
use std::sync::OnceLock;
|
||||
static REF: OnceLock<Option<[f64; 16]>> = OnceLock::new();
|
||||
REF.get_or_init(|| {
|
||||
let full = deck::without_in(rules.deck, &[]);
|
||||
let mut rng = Rng::seeded(REFERENCE_SEED);
|
||||
let mut sum = [0.0; 16];
|
||||
let mut n = 0usize;
|
||||
for _ in 0..REFERENCE_BOARDS {
|
||||
let (board, next) = deck::draw(&full, 5, rng)?;
|
||||
rng = next;
|
||||
if let Some(s) = shares_at_least(rules, &board) {
|
||||
for (a, b) in sum.iter_mut().zip(s) {
|
||||
*a += b;
|
||||
}
|
||||
n += 1;
|
||||
}
|
||||
}
|
||||
(n > 0).then(|| sum.map(|a| a / n as f64))
|
||||
})
|
||||
.as_ref()
|
||||
}
|
||||
|
||||
/// The board-relative floor as a showdown-strength cut: the strength of the `ceil(q * n)`-th
|
||||
/// strongest of all `n` holdings on this board, `q` the reference share of `floor` (its share of all
|
||||
/// holdings on an average river). `None` when the class floor already admits no more than `q` here
|
||||
/// (dry board: nothing changes), or without a full Hold'em river board.
|
||||
pub fn strength_cut(rules: &Rules, board: &[Card], floor: Made) -> Option<Strength> {
|
||||
if board.len() != 5 || rules.hole_cards != 2 {
|
||||
return None;
|
||||
}
|
||||
let reference = reference(rules)?;
|
||||
let here = shares_at_least(rules, board)?;
|
||||
let i = ALL.iter().position(|m| *m == floor)?;
|
||||
let q = reference[i];
|
||||
if here[i] <= q + 1e-12 {
|
||||
return None;
|
||||
}
|
||||
let pool = deck::without_in(rules.deck, board);
|
||||
let mut all: Vec<Strength> = Vec::new();
|
||||
for a in 0..pool.len() {
|
||||
for b in a + 1..pool.len() {
|
||||
if let Ok(s) = judge(rules, &[pool[a], pool[b]], board) {
|
||||
all.push(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
all.sort_unstable_by(|x, y| y.cmp(x));
|
||||
let k = ((q * all.len() as f64).ceil() as usize).clamp(1, all.len().max(1));
|
||||
all.get(k - 1).copied()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::variant::kind::Variant;
|
||||
use crate::variant::rules::rules;
|
||||
|
||||
fn cards(s: &str) -> Vec<Card> {
|
||||
Card::parse_list(s).unwrap()
|
||||
}
|
||||
|
||||
fn strength(hole: &str, board: &str) -> Strength {
|
||||
judge(&rules(Variant::Nlhe), &cards(hole), &cards(board)).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dry_board_keeps_the_class_floor() {
|
||||
let r = rules(Variant::Nlhe);
|
||||
assert_eq!(strength_cut(&r, &cards("Kd 7s 2c 9h 4d"), Made::TopPairGoodKicker), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn paired_four_flush_board_puts_a_straight_below_the_cut() {
|
||||
let r = rules(Variant::Nlhe);
|
||||
let b = "9c 9h Tc 8c 2c";
|
||||
let cut = strength_cut(&r, &cards(b), Made::TopPairGoodKicker).expect("cut");
|
||||
assert!(strength("Jd 7d", b) < cut, "J-high straight must be below the board-relative floor");
|
||||
assert!(strength("Ac 3d", b) >= cut, "the nut flush stays value");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_cut_before_the_river() {
|
||||
let r = rules(Variant::Nlhe);
|
||||
assert_eq!(strength_cut(&r, &cards("9c 9h Tc 8c"), Made::TopPairGoodKicker), None);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ pub fn call_continuation(villain: &Villain, street: Street, ratio: f64, facing_r
|
||||
bluff_share: 0.0,
|
||||
continue_share: Some(1.0 - fold_chance(villain.profile.as_ref(), ratio, facing_raise)),
|
||||
top_share: None,
|
||||
min_strength: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,5 +43,6 @@ pub fn top_call_continuation(villain: &Villain, street: Street, ratio: f64, faci
|
||||
bluff_share: 0.0,
|
||||
continue_share: None,
|
||||
top_share: Some(1.0 - fold_chance(villain.profile.as_ref(), ratio, facing_raise)),
|
||||
min_strength: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ pub mod band_bounds;
|
||||
pub mod band_stretch;
|
||||
pub mod bet_ratio;
|
||||
pub mod bluff_share;
|
||||
pub mod brett_floor;
|
||||
pub mod call_floor;
|
||||
pub mod fold_chance;
|
||||
pub mod geeicht;
|
||||
|
||||
@@ -33,6 +33,10 @@ pub struct Continuation {
|
||||
/// this step (by made hand, then draw, `engine::range_filter`) as value; `bluff_share` is admitted
|
||||
/// below it as usual. A re-raise narrows the range this way per raise level (`RERAISE_TIEFE`).
|
||||
pub top_share: Option<f64>,
|
||||
/// `min_strength`, when set, also asks the value hands for at least this showdown strength on the
|
||||
/// board (`WERT_BRETT=river`, `exploit::brett_floor`): the board-relative river floor, an exact
|
||||
/// percentile of all holdings instead of a made class.
|
||||
pub min_strength: Option<crate::hand::strength::Strength>,
|
||||
}
|
||||
|
||||
impl RangeSpec {
|
||||
|
||||
@@ -294,6 +294,10 @@ fn on_street(
|
||||
bluff_share,
|
||||
continue_share: None,
|
||||
top_share: None,
|
||||
// WERT_BRETT=river: a river bet/raise floor means the same relative strength on every board.
|
||||
min_strength: (street == Street::River && made_bet.is_some() && super::brett_floor::enabled())
|
||||
.then(|| super::brett_floor::strength_cut(&spot.rules(), &spot.board, min_made))
|
||||
.flatten(),
|
||||
});
|
||||
// Each further aggression on the street keeps the strongest r^(k-1) of what the first left, with
|
||||
// the plain size bluff share below it (a sustained line earns no population over-bluff prior).
|
||||
|
||||
Reference in New Issue
Block a user