Die Welt nannte 'pokerfreak' nur noch in zwei Harness-Zeilen - der Rest waren veraltete Rust-Pruefungen im Pruefordner, die der Aufbau nie auffrischte.
112 lines
3.8 KiB
Rust
112 lines
3.8 KiB
Rust
//! Antes are dead money, not action: a pot of blinds plus antes is still unopened.
|
|
//!
|
|
//! Measured at the table 1000/2000: six antes of 320 make a first-in pot of 2.46 bb
|
|
//! (`game.potInfo` 4920), above the 2.25 bb the chip-count heuristic allows for "blinds only".
|
|
//!
|
|
//! Six-max, button on seat 3: EP 0, MP 1, CO 2, BTN 3, SB 4, BB 5. Big blind = 1.0.
|
|
use rechner::card::Card;
|
|
use rechner::exploit::thresholds::Thresholds;
|
|
use rechner::game::{ActionKind, ActionRecord, SeenAction, Spot, Street, Villain};
|
|
use rechner::preflop::advise::advise;
|
|
use rechner::preflop::plan::PreflopPlan;
|
|
use rechner::variant::Variant;
|
|
|
|
const ANTE: f64 = 0.16;
|
|
const SEATS: [u8; 6] = [0, 1, 2, 3, 4, 5];
|
|
|
|
fn record(seat: u8, action: SeenAction, amount: Option<f64>) -> ActionRecord {
|
|
ActionRecord { street: Street::Preflop, seat, action, amount }
|
|
}
|
|
|
|
fn table(ante: f64) -> Vec<ActionRecord> {
|
|
let mut h: Vec<ActionRecord> = if ante > 0.0 {
|
|
SEATS.iter().map(|s| record(*s, SeenAction::PostAnte, Some(ante))).collect()
|
|
} else {
|
|
Vec::new()
|
|
};
|
|
h.push(record(4, SeenAction::PostSmallBlind, Some(0.5)));
|
|
h.push(record(5, SeenAction::PostBigBlind, Some(1.0)));
|
|
h
|
|
}
|
|
|
|
fn spot(hole: &str, hero_seat: u8, history: Vec<ActionRecord>, pot: f64, to_call: f64) -> Spot {
|
|
Spot {
|
|
variant: Variant::Nlhe,
|
|
big_blind: 1.0,
|
|
seats: 6,
|
|
hero_seat,
|
|
button_seat: Some(3),
|
|
hero_cards: Card::parse_list(hole).expect("cards"),
|
|
board: vec![],
|
|
street: Street::Preflop,
|
|
pot,
|
|
to_call,
|
|
hero_stack: 100.0,
|
|
min_raise_to: Some(2.0 * to_call.max(1.0) + 1.0),
|
|
max_raise_to: Some(100.0),
|
|
legal: vec![ActionKind::Fold, ActionKind::Call, ActionKind::Raise],
|
|
allowed_sizes: None,
|
|
villains: SEATS
|
|
.iter()
|
|
.filter(|s| **s != hero_seat)
|
|
.map(|s| Villain { seat: *s, stack: 100.0, folded: false, profile: None })
|
|
.collect(),
|
|
seed: 1,
|
|
history,
|
|
}
|
|
}
|
|
|
|
fn plan(s: &Spot) -> PreflopPlan {
|
|
advise(s, &Thresholds::BASE)
|
|
}
|
|
|
|
#[test]
|
|
fn a_full_table_of_antes_is_still_first_in() {
|
|
let antes = plan(&spot("Ah Kd", 3, table(ANTE), 1.5 + 6.0 * ANTE, 1.0));
|
|
let free = plan(&spot("Ah Kd", 3, table(0.0), 1.5, 1.0));
|
|
assert!(antes.reason.contains("CFR"), "{}", antes.reason);
|
|
assert_eq!(antes.reason, free.reason);
|
|
assert_eq!(antes.action, free.action);
|
|
}
|
|
|
|
#[test]
|
|
fn the_small_blind_first_in_reads_the_table_with_antes() {
|
|
let p = plan(&spot("Qh 3d", 4, table(ANTE), 1.5 + 6.0 * ANTE, 0.5));
|
|
assert!(p.reason.contains("CFR"), "{}", p.reason);
|
|
}
|
|
|
|
#[test]
|
|
fn a_limper_is_still_a_limper_with_antes() {
|
|
let mut h = table(ANTE);
|
|
h.push(record(1, SeenAction::Call, Some(1.0)));
|
|
let antes = plan(&spot("Ah Kd", 3, h, 2.5 + 6.0 * ANTE, 1.0));
|
|
assert!(antes.reason.contains("limp"), "{}", antes.reason);
|
|
}
|
|
|
|
#[test]
|
|
fn an_open_is_still_an_open_with_antes() {
|
|
let mut h = table(ANTE);
|
|
h.push(record(0, SeenAction::Raise, Some(2.5)));
|
|
let antes = plan(&spot("Ah Kd", 3, h.clone(), 4.0 + 6.0 * ANTE, 2.5));
|
|
let mut free = table(0.0);
|
|
free.push(record(0, SeenAction::Raise, Some(2.5)));
|
|
assert_eq!(antes.reason, plan(&spot("Ah Kd", 3, free, 4.0, 2.5)).reason);
|
|
}
|
|
|
|
#[test]
|
|
fn a_big_pot_without_ante_records_still_counts_as_limped() {
|
|
// No history to tell antes from a limp: the chip count stays the only witness.
|
|
let p = plan(&spot("Ah Kd", 3, Vec::new(), 2.46, 1.0));
|
|
assert!(p.reason.contains("limp"), "{}", p.reason);
|
|
}
|
|
|
|
#[test]
|
|
fn unusable_ante_amounts_are_ignored() {
|
|
let mut h = table(0.0);
|
|
h.push(record(0, SeenAction::PostAnte, Some(f64::NAN)));
|
|
h.push(record(1, SeenAction::PostAnte, Some(-5.0)));
|
|
h.push(record(2, SeenAction::PostAnte, None));
|
|
let p = plan(&spot("Ah Kd", 3, h, 2.46, 1.0));
|
|
assert!(p.reason.contains("limp"), "{}", p.reason);
|
|
}
|