Files
pokerfreak/src/odds/ev.rs
T

37 lines
1.4 KiB
Rust

//! Expected value per action, in chips, relative to folding now (fold = 0).
//!
//! Approximations (documented, deliberate):
//! * Hero has nothing committed on this street, so a raise "to X" adds X chips.
//! * If a raise is called, exactly one villain calls and adds `X - to_call`
//! (the existing bet is already in the pot); the rest fold.
//! * `share` (equity) is realised in full; no later-street betting is modelled.
/// Folding is the reference point.
pub fn fold() -> f64 {
0.0
}
/// Free check: hero keeps `share` of the current pot.
pub fn check(share: f64, pot: f64) -> f64 {
share * pot
}
/// Call: `share * (pot + to_call) - to_call`.
pub fn call(share: f64, pot: f64, to_call: f64) -> f64 {
share * (pot + to_call) - to_call
}
/// Pot after a raise adding `added` chips that one villain calls:
/// `pot + added + max(added - to_call, 0)`. Also the money at stake in the raise,
/// used to scale its EV standard error.
pub fn final_pot(pot: f64, to_call: f64, added: f64) -> f64 {
pot + added + (added - to_call).max(0.0)
}
/// Raise adding `added` chips, with fold probability `fe`:
/// `fe * pot + (1 - fe) * (share * final_pot - added)` where
/// `final_pot = pot + added + max(added - to_call, 0)`.
pub fn raise(share: f64, pot: f64, to_call: f64, added: f64, fe: f64) -> f64 {
fe * pot + (1.0 - fe) * (share * final_pot(pot, to_call, added) - added)
}