Owner 8.11.: 'reizen wir das Wissen aus?' - CoinPokers HUD liefert ~13 Werte, die Engine nutzte 4. Jetzt fliessen die 8 brachliegenden (cbet, foldToCbet, threeBet, foldToThreeBet, steal, checkRaise, wtsd, wsd) end-to-end bis ins Rust-Profile (lesen/profil DURCHGEREICHT -> wire/decode_villain -> exploit/profile, sample/mark mit None-Prior = Clientwert unveraendert). NOCH keine Exploit-Regel liest sie: eine wtsd-Regel wurde gebaut, durch die Leiter-Benchmark NICHT bewiesen (Stationen leicht negativ, kein Gewinn) und VERWORFEN - keine unbewiesene Kante gegen Echtgeld. Engine bit-identisch zur Basislinie (Benchmark GESAMT nicht unterscheidbar, kein Reg schlechter). Neu: lesen/gedaechtnis.py - Delta-Speicher je User-ID (gezeigte Haende, Sizing/Timing-Buckets, Tendenz, vs-uns), speichert NUR was CoinPoker nicht liefert. Specs: profil 15, gedaechtnis 11, Rust-Fixtures gruen. (Subagent-Arbeit, von mir verifiziert + Benchmark- geprueft + committet.)
115 lines
3.6 KiB
Rust
115 lines
3.6 KiB
Rust
#![allow(dead_code)]
|
|
//! Builders for range-model tests. Table: 6 seats, 0-based, button on seat 3:
|
|
//! seat 3 BTN, 4 SB, 5 BB, 0 UTG (early), 1 MP (middle), 2 CO. Hero sits on seat 0.
|
|
|
|
use rechner::card::Card;
|
|
use rechner::exploit::profile::Profile;
|
|
use rechner::exploit::range_spec::{Continuation, RangeSpec};
|
|
use rechner::game::{ActionKind, ActionRecord, SeenAction, Spot, Street, Villain};
|
|
use rechner::variant::Variant;
|
|
|
|
pub const HERO: u8 = 0;
|
|
pub const MIDDLE: u8 = 1;
|
|
pub const CUTOFF: u8 = 2;
|
|
pub const BUTTON: u8 = 3;
|
|
pub const SMALL_BLIND: u8 = 4;
|
|
pub const BIG_BLIND: u8 = 5;
|
|
|
|
pub fn at(street: Street, seat: u8, action: SeenAction, amount: Option<f64>) -> ActionRecord {
|
|
ActionRecord { street, seat, action, amount }
|
|
}
|
|
|
|
pub fn pre(seat: u8, action: SeenAction) -> ActionRecord {
|
|
at(Street::Preflop, seat, action, None)
|
|
}
|
|
|
|
pub fn pre_amt(seat: u8, action: SeenAction, amount: f64) -> ActionRecord {
|
|
at(Street::Preflop, seat, action, Some(amount))
|
|
}
|
|
|
|
pub fn post(street: Street, seat: u8, action: SeenAction) -> ActionRecord {
|
|
at(street, seat, action, None)
|
|
}
|
|
|
|
pub fn blinds() -> Vec<ActionRecord> {
|
|
vec![pre_amt(4, SeenAction::PostSmallBlind, 0.5), pre_amt(5, SeenAction::PostBigBlind, 1.0)]
|
|
}
|
|
|
|
/// Blinds followed by `rest`.
|
|
pub fn hand(rest: Vec<ActionRecord>) -> Vec<ActionRecord> {
|
|
[blinds(), rest].concat()
|
|
}
|
|
|
|
pub fn villain(seat: u8, profile: Option<Profile>) -> Villain {
|
|
Villain { seat, stack: 100.0, folded: false, profile }
|
|
}
|
|
|
|
pub fn profile(vpip: Option<f64>, pfr: Option<f64>, fold: Option<f64>) -> Option<Profile> {
|
|
Some(Profile { vpip, pfr, fold_to_bet: fold, aggression: None, ..Profile::default() })
|
|
}
|
|
|
|
pub fn vpip(value: f64) -> Option<Profile> {
|
|
profile(Some(value), None, None)
|
|
}
|
|
|
|
pub fn board_of(len: usize) -> Vec<Card> {
|
|
Card::parse_list(&"Kc 7d 2s 9h 4c"[..len * 3 - usize::from(len > 0)]).unwrap()
|
|
}
|
|
|
|
fn street_of(len: usize) -> Street {
|
|
match len {
|
|
0 => Street::Preflop,
|
|
3 => Street::Flop,
|
|
4 => Street::Turn,
|
|
_ => Street::River,
|
|
}
|
|
}
|
|
|
|
/// A spot on the street matching `board_len` with the given history; villains: all but hero.
|
|
pub fn spot(board_len: usize, history: Vec<ActionRecord>, profile: Option<Profile>) -> Spot {
|
|
Spot {
|
|
variant: Variant::Nlhe,
|
|
big_blind: 1.0,
|
|
seats: 6,
|
|
hero_seat: HERO,
|
|
button_seat: Some(3),
|
|
hero_cards: Card::parse_list("Ah Qd").unwrap(),
|
|
board: if board_len == 0 { vec![] } else { board_of(board_len) },
|
|
street: street_of(board_len),
|
|
pot: 10.0,
|
|
to_call: 0.0,
|
|
hero_stack: 100.0,
|
|
min_raise_to: None,
|
|
max_raise_to: None,
|
|
legal: vec![ActionKind::Check, ActionKind::Raise],
|
|
allowed_sizes: None,
|
|
villains: [1u8, 2, 3, 4, 5].iter().map(|s| villain(*s, profile)).collect(),
|
|
seed: 1,
|
|
history,
|
|
}
|
|
}
|
|
|
|
pub fn spec(spot: &Spot, seat: u8) -> RangeSpec {
|
|
let v = spot.villains.iter().find(|v| v.seat == seat).cloned().unwrap_or(villain(seat, None));
|
|
rechner::exploit::range_model::range_spec(spot, &v)
|
|
}
|
|
|
|
pub fn width(s: &RangeSpec) -> f64 {
|
|
s.hi - s.lo
|
|
}
|
|
|
|
pub fn well_formed(s: &RangeSpec, board_len: usize) -> bool {
|
|
let sorted = s.continues.windows(2).all(|w| w[0].board_len < w[1].board_len);
|
|
s.lo.is_finite()
|
|
&& s.hi.is_finite()
|
|
&& s.lo >= 0.0
|
|
&& s.hi <= 1.0
|
|
&& s.hi - s.lo >= 0.03 - 1e-12
|
|
&& sorted
|
|
&& s.continues.iter().all(|c: &Continuation| (3..=5).contains(&c.board_len) && c.board_len <= board_len)
|
|
}
|
|
|
|
pub fn continuation(s: &RangeSpec, board_len: usize) -> Option<Continuation> {
|
|
s.continues.iter().find(|c| c.board_len == board_len).copied()
|
|
}
|