Files
pokerfreak/src/preflop/effective_stack.rs
T
mmintelandClaude Opus 5.5 ec800a1672 Preflop charts and exploitation layer
Hand percentiles (169-class equity ranking, Omaha-5 structural score with
empirical CDF), position/situation inference, position x situation charts,
all-in-or-fold charts, pot-odds all-in calls, advise(); exploit style
classification, threshold adjustment and villain range guess.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 12:00:21 +01:00

29 lines
911 B
Rust

//! Effective stack in big blinds.
use crate::game::Spot;
/// Used when the numbers cannot be trusted: deep enough not to trigger any short-stack rule.
pub const UNKNOWN_DEEP_BB: f64 = 100.0;
fn usable(x: f64) -> bool {
x.is_finite() && x > 0.0
}
/// `min(hero stack, largest live villain stack)` in big blinds; hero's stack alone when
/// no live villain with a usable stack is known. Unusable numbers give `UNKNOWN_DEEP_BB`.
pub fn effective_stack_bb(spot: &Spot) -> f64 {
let largest_villain = spot
.live_villains()
.map(|v| v.stack)
.filter(|s| usable(*s))
.fold(None, |best: Option<f64>, s| {
Some(best.map_or(s, |b| b.max(s)))
});
let chips = largest_villain.map_or(spot.hero_stack, |v| v.min(spot.hero_stack));
if usable(chips) && usable(spot.big_blind) {
chips / spot.big_blind
} else {
UNKNOWN_DEEP_BB
}
}