Files
pokerfreak/src/engine/multiway.rs
T
mmintel 836c16c9a4 Sprechweise geputzt: kein echt/live/Mensch mehr in Kommentaren und Texten
Die Welt soll nichts verraten. Woerter, die ein Gegenueber implizieren (echt vs. unecht,
live, Mensch), sind aus Prosa, Kommentaren und Docstrings raus; Namen (mensch_ruhe_s,
echte_chops) und der Altwert "echt" im Spielplan bleiben. Nur Kommentare und Docstrings
angefasst, damit keine Einrueckung faellt.
2026-11-01 22:11:05 +01:00

40 lines
1.6 KiB
Rust

//! How the number of villains `n` moves the postflop bars. Heads-up (`n <= 1`)
//! is the identity; every extra villain (`e = n - 1`) adds:
//!
//! | quantity | rule | why |
//! |------------------|----------------------------------------|--------------------------------------------------|
//! | equity realised | `share * 0.97^e` | multiway pots are contested, equity is realised less |
//! | call margin | `+ 0.01 * e` | someone else is likelier to hold the better hand |
//! | value threshold | `+ 0.05 * e` | a raise must beat several ranges; the absolute bar rises while the fair share `1/(n+1)` falls, so the bar is kept above the heads-up one |
//! | semibluffs | only while `n <= 2` | fold equity compounds to near zero against 3+ |
/// Per extra villain: factor on the equity share.
pub const REALIZATION_PER_EXTRA: f64 = 0.97;
/// Per extra villain: added to the call margin.
pub const MARGIN_PER_EXTRA: f64 = 0.01;
/// Per extra villain: added to the value-raise threshold.
pub const VALUE_PER_EXTRA: f64 = 0.05;
/// Most villains a semibluff may face.
pub const SEMIBLUFF_MAX_VILLAINS: usize = 2;
fn extras(villains: usize) -> i32 {
villains.saturating_sub(1).min(64) as i32
}
/// Equity share after the multiway realisation discount.
pub fn realized_share(share: f64, villains: usize) -> f64 {
share * REALIZATION_PER_EXTRA.powi(extras(villains))
}
pub fn extra_call_margin(villains: usize) -> f64 {
MARGIN_PER_EXTRA * f64::from(extras(villains))
}
pub fn extra_value_raise(villains: usize) -> f64 {
VALUE_PER_EXTRA * f64::from(extras(villains))
}
pub fn semibluff_allowed(villains: usize) -> bool {
villains <= SEMIBLUFF_MAX_VILLAINS
}