Files
pokerfreak/src/engine/effective.rs
T

38 lines
1.5 KiB
Rust

use super::multiway::{extra_call_margin, extra_value_raise, realized_share, semibluff_allowed};
use super::texture_stance::texture_stance;
use crate::exploit::thresholds::Thresholds;
use crate::game::{ActionKind, Spot};
use crate::read::hand_read::HandRead;
/// Everything the choice needs, after texture and multiway adjustments.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Effective {
/// villains, at least 1.
pub villains: usize,
/// Equity share after the multiway realisation discount.
pub share: f64,
pub call_margin: f64,
pub value_raise: f64,
pub value_ok: bool,
pub raise_ok: bool,
pub semibluff_ok: bool,
}
/// `thresholds` seen through the hand read (`texture_stance`) and the number of
/// villains (`multiway`). Pure; heads-up with a monster is the identity.
pub fn effective(spot: &Spot, share: f64, thresholds: &Thresholds, read: &HandRead) -> Effective {
let live = spot.live_villains().count();
let villains = live.max(1);
let facing_bet = spot.to_call > 0.0 && spot.is_legal(ActionKind::Call);
let stance = texture_stance(thresholds, read, facing_bet);
Effective {
villains,
share: realized_share(share, villains),
call_margin: stance.call_margin + extra_call_margin(villains),
value_raise: (stance.value_raise + extra_value_raise(villains)).min(0.95),
value_ok: stance.value_ok,
raise_ok: stance.raise_ok,
semibluff_ok: semibluff_allowed(villains),
}
}