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>
60 lines
2.0 KiB
Rust
60 lines
2.0 KiB
Rust
use pokerfreak::preflop::situation::{classify, Situation};
|
|
|
|
// classify(to_call, big_blind, pot, hero_stack); everything in big blinds (bb = 1.0).
|
|
|
|
#[test]
|
|
fn unopened_pots() {
|
|
assert_eq!(classify(0.5, 1.0, 1.5, 100.0), Situation::Unopened); // small blind
|
|
assert_eq!(classify(1.0, 1.0, 1.5, 100.0), Situation::Unopened); // button, blinds only
|
|
assert_eq!(classify(0.0, 1.0, 1.5, 100.0), Situation::Unopened);
|
|
}
|
|
|
|
#[test]
|
|
fn limped_pots() {
|
|
assert_eq!(classify(1.0, 1.0, 2.5, 100.0), Situation::FacingLimp);
|
|
assert_eq!(classify(0.5, 1.0, 3.0, 100.0), Situation::FacingLimp);
|
|
assert_eq!(classify(0.0, 1.0, 2.5, 100.0), Situation::FacingLimp); // big blind option
|
|
}
|
|
|
|
#[test]
|
|
fn single_raise() {
|
|
assert_eq!(classify(3.0, 1.0, 4.5, 100.0), Situation::FacingOpen);
|
|
assert_eq!(classify(2.0, 1.0, 4.5, 100.0), Situation::FacingOpen); // big blind vs 3x
|
|
assert_eq!(classify(4.5, 1.0, 6.0, 100.0), Situation::FacingOpen);
|
|
}
|
|
|
|
#[test]
|
|
fn re_raises() {
|
|
assert_eq!(
|
|
classify(9.0, 1.0, 13.5, 100.0),
|
|
Situation::FacingThreeBetPlus
|
|
);
|
|
assert_eq!(
|
|
classify(6.0, 1.0, 13.5, 100.0),
|
|
Situation::FacingThreeBetPlus
|
|
); // opener vs 3-bet
|
|
assert_eq!(
|
|
classify(20.0, 1.0, 30.0, 100.0),
|
|
Situation::FacingThreeBetPlus
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn all_in_when_the_call_takes_the_stack() {
|
|
assert_eq!(classify(20.0, 1.0, 30.0, 20.0), Situation::FacingAllIn);
|
|
assert_eq!(classify(25.0, 1.0, 30.0, 20.0), Situation::FacingAllIn);
|
|
assert_eq!(classify(100.0, 1.0, 150.0, 100.0), Situation::FacingAllIn);
|
|
assert_ne!(classify(0.0, 1.0, 1.5, 0.0), Situation::FacingAllIn);
|
|
}
|
|
|
|
#[test]
|
|
fn bad_numbers_never_panic() {
|
|
assert_eq!(classify(0.0, 0.0, 0.0, 0.0), Situation::Unopened);
|
|
let nan = f64::NAN;
|
|
let _ = classify(nan, 1.0, 1.5, 10.0);
|
|
let _ = classify(1.0, nan, 1.5, 10.0);
|
|
let _ = classify(1.0, 1.0, nan, nan);
|
|
let _ = classify(f64::INFINITY, 1.0, f64::INFINITY, f64::INFINITY);
|
|
let _ = classify(-1.0, -1.0, -1.0, -1.0);
|
|
}
|