Files
pokerfreak/tests/exploit_adjust.rs
T
mmintel e107be73a5 Phase E: HUD voll in die Engine durchgereicht + Delta-Gedaechtnis je Spieler
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.)
2026-11-08 22:02:45 +01:00

132 lines
3.8 KiB
Rust

use rechner::exploit::adjust::adjust;
use rechner::exploit::profile::Profile;
use rechner::exploit::thresholds::Thresholds;
const BASE: Thresholds = Thresholds::BASE;
fn profile(vpip: Option<f64>, pfr: Option<f64>, fold_to_bet: Option<f64>) -> Profile {
Profile {
vpip,
pfr,
fold_to_bet,
aggression: None,
..Profile::default()
}
}
fn station() -> Profile {
profile(Some(0.50), Some(0.05), Some(0.20))
}
fn nit() -> Profile {
profile(Some(0.10), Some(0.07), Some(0.75))
}
fn maniac() -> Profile {
profile(Some(0.60), Some(0.40), Some(0.40))
}
#[test]
fn no_information_changes_nothing() {
assert_eq!(adjust(BASE, &[]), BASE);
assert_eq!(adjust(BASE, &[Profile::default()]), BASE);
assert_eq!(
adjust(BASE, &[Profile::default(), Profile::default()]),
BASE
);
}
#[test]
fn calling_stations_are_value_bet_thinner_and_not_bluffed() {
let t = adjust(BASE, &[station()]);
// Fold equity is per opponent now (`exploit::fold_chance`), not a shared threshold.
assert_eq!(t.fold_equity_scale, BASE.fold_equity_scale, "{t:?}");
assert!(t.value_raise < BASE.value_raise);
}
#[test]
fn nits_fold_more_and_bet_strong() {
let t = adjust(BASE, &[nit()]);
assert_eq!(t.fold_equity_scale, BASE.fold_equity_scale);
assert!(t.call_margin > BASE.call_margin);
assert!(t.range_width_scale < BASE.range_width_scale);
}
#[test]
fn aggressive_players_are_called_wider() {
let t = adjust(BASE, &[maniac()]);
assert!(t.call_margin < BASE.call_margin);
assert!(t.range_width_scale > BASE.range_width_scale);
}
#[test]
fn fold_to_bet_no_longer_moves_the_shared_scale() {
// foldToBet enters per opponent through `fold_chance`; counting it here too would
// count it twice.
for i in 0..=20 {
let t = adjust(BASE, &[profile(Some(0.3), Some(0.1), Some(i as f64 / 20.0))]);
assert_eq!(t.fold_equity_scale, BASE.fold_equity_scale);
}
}
#[test]
fn several_profiles_combine_conservatively() {
let (s, n) = (adjust(BASE, &[station()]), adjust(BASE, &[nit()]));
let both = adjust(BASE, &[station(), nit()]);
assert_eq!(both.call_margin, s.call_margin.max(n.call_margin));
assert_eq!(
both.fold_equity_scale,
s.fold_equity_scale.min(n.fold_equity_scale)
);
assert_eq!(both.value_raise, s.value_raise.max(n.value_raise));
assert_eq!(
both.range_width_scale,
s.range_width_scale.min(n.range_width_scale)
);
// order does not matter, unknowns are ignored
assert_eq!(adjust(BASE, &[nit(), Profile::default(), station()]), both);
}
#[test]
fn outputs_stay_in_sane_ranges_for_any_input() {
let grid = [
None,
Some(-1.0),
Some(0.0),
Some(0.3),
Some(1.0),
Some(9.0),
Some(f64::NAN),
Some(f64::INFINITY),
];
for vpip in grid {
for pfr in grid {
for ftb in grid {
let t = adjust(BASE, &[profile(vpip, pfr, ftb)]);
assert!((0.0..=0.15).contains(&t.call_margin), "{t:?}");
assert!((0.52..=0.85).contains(&t.value_raise), "{t:?}");
assert!((0.0..=0.05).contains(&t.abstain_band), "{t:?}");
assert!((0.3..=1.6).contains(&t.fold_equity_scale), "{t:?}");
assert!((0.6..=1.4).contains(&t.range_width_scale), "{t:?}");
}
}
}
}
#[test]
fn adjust_is_pure() {
let ps = [station(), maniac()];
assert_eq!(adjust(BASE, &ps), adjust(BASE, &ps));
}
#[test]
fn adjustments_compose_with_a_non_default_base() {
let tight = Thresholds {
fold_equity_scale: 0.8,
..BASE
};
// The shared fold-equity scale passes through untouched (profiles act per opponent).
assert_eq!(adjust(tight, &[nit()]).fold_equity_scale, 0.8);
assert_eq!(adjust(tight, &[station()]).fold_equity_scale, 0.8);
}