Leiter: Engine bekommt Gegner-Reads (Benchmark-Treue)

Die Leiter testete die Engine blind - Villains hatten kein Profil, also war die
ganze Ausbeutungslogik auf dem Pruefstand aus. Jetzt fuettert der Tisch jeder
Villain den Read, den ein eingespieltes HUD zeigen wuerde (sim/reads), je
Gegner-Archetyp. Vertrag per Test: jeder Stil klassifiziert korrekt
(Fish/Station -> breit-schwach, Maniac -> loose-aggressiv, Reg/Nit sauber).

Nur Sim/Benchmark, nicht der Request-Pfad - kein Einfluss auf den Live-Bot.
This commit is contained in:
2026-11-06 18:30:50 +01:00
parent 1fd69b1887
commit 23a6fe6ed2
4 changed files with 76 additions and 1 deletions
+1
View File
@@ -7,5 +7,6 @@ pub mod luck;
pub mod opponent;
pub mod paired;
pub mod reader;
pub mod reads;
pub mod session;
pub mod table;
+35
View File
@@ -0,0 +1,35 @@
//! The read a converged HUD would show for each fixed opponent. The ladder plays the engine against
//! behavioural opponents; to measure the EXPLOIT brain the engine must also SEE them, the way it sees
//! vpip/pfr/foldToBet/aggression at a real table. These are representative, stable profiles for each
//! archetype (a long session converges to them, since the sim opponents are fixed-style), so the
//! engine's opponent classification (`exploit::style::classify`) lands on the matching style.
//!
//! `RandomLegal` has no coherent style, so it carries no read (the engine plays it blind).
use super::opponent::Opponent;
use super::reader::Style;
use crate::exploit::profile::Profile;
fn p(vpip: f64, pfr: f64, fold_to_bet: f64, aggression: f64) -> Option<Profile> {
Some(Profile {
vpip: Some(vpip),
pfr: Some(pfr),
fold_to_bet: Some(fold_to_bet),
aggression: Some(aggression),
})
}
/// The HUD read the engine is handed for this opponent, or `None` when the opponent has no readable
/// style. Values mirror the opponent's behaviour: the calling station almost never folds and never
/// raises; the fish calls far too light; the maniac is loose and very aggressive; the nit is tight.
pub fn opponent_profile(opponent: Opponent) -> Option<Profile> {
match opponent {
Opponent::CallingStation => p(0.75, 0.00, 0.03, 0.03),
Opponent::Folder => p(0.02, 0.00, 0.95, 0.00),
Opponent::RandomLegal => None,
Opponent::Reader(Style::Fish) => p(0.55, 0.05, 0.15, 0.10),
Opponent::Reader(Style::Reg) => p(0.26, 0.19, 0.50, 0.50),
Opponent::Reader(Style::Nit) => p(0.13, 0.10, 0.72, 0.35),
Opponent::Reader(Style::Maniac) => p(0.55, 0.38, 0.25, 0.90),
}
}
+4 -1
View File
@@ -172,9 +172,12 @@ impl Table<'_> {
if view.min_raise_to.is_some() {
legal.push(ActionKind::Raise);
}
// The engine sees the opponents the way a converged HUD would (`sim::reads`), so the ladder
// measures the exploit brain instead of playing it blind.
let read = super::reads::opponent_profile(self.setup.opponent);
let villains = (0..self.players())
.filter(|j| *j != i)
.map(|j| Villain { seat: j as u8 + 1, stack: self.stack[j], folded: self.folded[j], profile: None })
.map(|j| Villain { seat: j as u8 + 1, stack: self.stack[j], folded: self.folded[j], profile: read })
.collect();
let decision_seed = self.setup.seed ^ (self.result.hero_decisions as u64 + 1).wrapping_mul(0x9E37_79B9_7F4A_7C15);
Spot {
+36
View File
@@ -0,0 +1,36 @@
//! Benchmark-Treue: der Read, den die Leiter der Engine je Gegner gibt, muss auf den PASSENDEN
//! Ausbeutungs-Stil klassifizieren - sonst misst die Leiter das Falsche. Besonders der Riegel gegen
//! das Zocken: ein Maniac darf NIE als breit-schwach (Calling Station) durchgehen.
use rechner::exploit::style::{classify, Style};
use rechner::sim::opponent::Opponent;
use rechner::sim::reader::Style as SimStyle;
use rechner::sim::reads::opponent_profile;
fn stil(o: Opponent) -> Style {
classify(&opponent_profile(o).expect("Gegner mit lesbarem Stil"))
}
#[test]
fn calling_station_und_fisch_sind_breit_schwach() {
assert_eq!(stil(Opponent::CallingStation), Style::CallingStation);
assert_eq!(stil(Opponent::Reader(SimStyle::Fish)), Style::CallingStation);
}
#[test]
fn der_maniac_ist_loose_aggressiv_nicht_breit_schwach() {
// Kernregel: gegen Aggression wird NICHT erleichtert - der Maniac darf nie als Station zaehlen.
assert_eq!(stil(Opponent::Reader(SimStyle::Maniac)), Style::LooseAggressive);
}
#[test]
fn reg_ist_regular_nit_ist_nit() {
assert_eq!(stil(Opponent::Reader(SimStyle::Reg)), Style::Regular);
assert_eq!(stil(Opponent::Reader(SimStyle::Nit)), Style::Nit);
}
#[test]
fn der_folder_ist_ein_nit_das_random_legal_ohne_read() {
assert_eq!(stil(Opponent::Folder), Style::Nit);
assert!(opponent_profile(Opponent::RandomLegal).is_none());
}