Soft-Trust: konfidenz-gewichtetes Stations-Trust schliesst den Nemesis-Rest

Leak 2 war mit dem 0.45-Aggressions-Tor grob gefixt (classify liest den
aggressiven Vielfalter als Regular, nicht Station). Die CMA-ES gegen die
reparierte Engine fand aber nemesis-2 knapp unter dem Tor (aggr 0.41) ->
voll getrustete Station -> -87.63 bb/100.

Wurzel: das binaere earned_trust (1.0/0.0) gibt einem Grenzfall den vollen
Exploit oder gar keinen. read_gate nennt die Loesung selbst - ein f64 fuer
"partial, confidence-weighted trust". station_trust() ist jetzt eine Rampe:
1.0 fuer echte passive Station (bit-identisch zu vorher, keine Regression),
linear auf 0 Richtung 0.45-Grenze.

Vier gemessene Kanaele, die das Stations-Profil lesen, je per toward_blind
mit dem Trust skaliert (bit-identisch bei c=1): adjust (Schwellen), style_rung
(Boden-Sprosse), range_model (Band-Stretch), fold_chance (Fold-Equity, der
dominante). nemesis-2 Memory -87.63 -> +83.72 bb/100 (Blind-Decke +114.01).

Beweis: Zwillings-Tor Gate::passes (OFFENSE +50.58, Boden gto -23.93 und
Exploitability 77.03 bit-identisch), Boden-Archetypen unregressiert,
101 Lib-Tests gruen. Der neue Worst-Case nemesis-3 (-26.59) ist read-invariant
(Oracle=Blind=Memory, classify Regular) - ein vorbestehendes River-Overbet-
Defense-Loch fuer den River-Solver, von diesem Fix unberuehrt.

Befunde: BEFUND-nemesis-soft-trust.md, BEFUND-nemesis-station-fehllabel.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 19:58:59 +01:00
co-authored by Claude Opus 4.8
parent efcff2b2fb
commit b360796d2e
11 changed files with 876 additions and 24 deletions
+171
View File
@@ -0,0 +1,171 @@
# Befund: Konfidenz-gewichtetes Stations-Trust — der Rest-Nemesis an der Klassengrenze
Nachsuche zu [[BEFUND-nemesis-station-fehllabel]]: der 0.45-Tor-Fix kippte den groben Fehllabel
(−409.86 → +80.73 bb/100), aber die CMA-ES gegen die reparierte Engine fand **Nemesis-2** — denselben
lesegetriebenen Leck-Typ, nur mit einer Aggression **knapp unter** dem Tor:
```
Nemesis-2 call_margin 0.173 raise_at 0.579 bet_at 0.748 open_at 0.800 bluff 0.229 size 0.996
Blind +114.01 bb/100
Memory -87.63 bb/100 konvergierter Read: vpip 0.65 pfr 0.15 fold2bet 0.56 aggr 0.41 -> CallingStation
```
Aggr 0.41 < 0.45 → er rutscht zurück in die **voll getrustete** Station und kassiert denselben Exploit.
## Warum kein tieferes Tor
Das Tor von 0.45 auf 0.40 zu senken, um aggr 0.41 zu fangen, quetscht den Reg-Archetyp (gemessene
Aggression 0.31 — nur 0.09 Luft, Memory-Rauschen überlappt), und die CMA-ES findet dann ein Nemesis-3
bei aggr ~0.33. Das ist Whack-a-Mole. Die Wurzel ist **nicht** die Lage des Tors, sondern seine
**Binärheit**: `earned_trust` gibt 1.0 für CallingStation und 0.0 sonst — ein Gegner direkt an der
Grenze bekommt den vollen Station-Exploit oder gar keinen. `read_gate` nennt das selbst als nächsten
Schritt: „The value is an f64, not a bool, to leave room for a partial, confidence-weighted trust later
without changing this seam."
## Der Fix: Trust als Konfidenz, nicht als Schalter
`exploit::style::station_trust(profile) -> f64` — eine Rampe statt eines Sprungs:
```rust
const STATION_MAX_AGGRESSION: f64 = 0.45; // oberhalb: keine Station (unverändert)
const STATION_FULL_TRUST_AGGRESSION: f64 = 0.20; // unterhalb: echte Station, volles Trust
pub fn station_trust(profile: &Profile) -> f64 {
if frequency(profile.fold_to_bet).is_some_and(|b| b <= STATION_FOLD_TO_BET) {
return 1.0; // ein echter Nicht-Folder: Nicht-Folden ist das Signal
}
match frequency(profile.aggression) {
None => 1.0, // kein Postflop-Sample: altes Verhalten, nichts regressiert
Some(a) => ((STATION_MAX_AGGRESSION - a)
/ (STATION_MAX_AGGRESSION - STATION_FULL_TRUST_AGGRESSION)).clamp(0.0, 1.0),
}
}
```
Eine echte passive Station (aggr ≤ 0.20, oder ein Nicht-Folder) bekommt `c = 1.0` und ist
**bit-identisch** zum alten binären Trust. Ein Grenzfall-Gegner bekommt eine Teil-Konfidenz: Nemesis-2
(aggr 0.41) nur `c = (0.45−0.41)/(0.45−0.20) = 0.16`.
### Jeder Kanal, der das Stations-Profil liest, wird mit `c` zur Blind-Grundlinie gezogen
`toward_blind(blind, x, c) = blind + c·(x − blind)` — voller Read bei `c=1`, reine Blind-Decke bei
`c=0`. Die Messung (nicht die Theorie) zeigte **vier** Kanäle, die das getrustete Profil lesen; jeder
einzeln skaliert, jeder bit-identisch bei `c=1`:
1. **`adjust.rs`** — die Stations-Schwellen-Shifts (`call_margin`, `value_raise`, `range_width`) skalieren
mit `c`: `base + shift·c`.
2. **`style_rung.rs`** — die Made-Hand-Boden-Sprosse: `-(round(c) as i32)` statt fix `-1`.
3. **`range_model.rs`** — der Preflop-Band-Stretch und das `unknown_role_band`-vpip werden per
`toward_blind` zur Blind-Breite gezogen (eine breite vpip-Lesung widert die modellierte Range nur so
weit, wie der Read getrustet ist).
4. **`fold_chance.rs`** — `fold_base` wird zur `DEFAULT_FOLD_TO_BET` (0.45) gezogen: ein fehlgelesenes
aggressives „Station"-fold_to_bet 0.56 trustet hero nur partiell, also **über-barrelt er nicht** in
eine leicht-raisende Range, deren Mehr-Straßen-Kosten die Einzel-Straßen-Bluff-EV nie modelliert.
## Beweis: die Wiederherstellung
`bin/nemesis_read` (Memory, 4000 Austeilungen), progressiv je Kanal-Gruppe:
```
binäres Trust (nur 0.45-Tor) -87.63 bb/100
+ soft-trust auf adjust / rung / range -54.34 bb/100
+ soft-trust auf fold_chance (Fold-Equity) +83.72 bb/100 (Blind-Decke +114.01)
```
Der dominante Kanal war die **Fold-Equity**: hero barrelte Flop/Turn in die vermeintlich foldende
Station und landete auf schlechten Rivern. Von −87.63 auf **+83.72** — hero schlägt den CMA-ES-
Extrempunkt jetzt deutlich auch unter dem realistischen Memory-Read.
**Der Boden ist unberührt** (`bin/arch_read`, 4000 Austeilungen, gap = Memory − Blind):
```
style blind memory gap
fish +74.58 +129.38 +54.81 (echte Station, aggr 0.11 -> c=1.0, bit-identisch)
reg -13.40 +4.00 +17.40
nit +43.05 +47.75 +4.70
maniac +82.57 +82.57 +0.00 (bit-identisch)
```
Kein Archetyp regressiert — jeder gap ≥ 0. Fish (die echte Station) behält volles Trust und ist
bit-identisch; Maniac ist unberührt.
## Der Rest: Mehr-Straßen-Kosten, nicht noch ein Schwellen-Tweak
Die verbleibende Lücke zur Blind-Decke (−30 bb/100) ist im `diag_nemesis which=2` lokalisiert:
```
bucket mem blind DELTA mem# blind#
river fold -74.96 -9.61 -65.34 578 336
turn call -33.45 +6.82 -40.27 210 156
...
river call +11.92 -23.00 +34.92 75 362
```
Der Rest ist **River-Fold-Übersteuerung**: hero erreicht den River deutlich öfter (578 vs 336) und
foldet — er floatet/barrelt die Vorstraßen noch etwas zu leicht und zahlt es auf dem River. Das ist
**keine** Trust-Kalibrierung mehr, sondern die bekannte Struktur-Grenze: die Einzel-Straßen-Bluff-EV
bucht fold × pot als Gewinn, ignoriert aber die Mehr-Straßen-Kosten der weiterspielenden (leicht-
raisenden, value-lastigen) Range. Das gehört in den opponent-aware, trust-gegateten River-Subgame-
Solver ([[engine-math-vision]] Stage A→live), nicht in einen weiteren Margin-Tweak. Nemesis-2 ist mit
+83.72 bb/100 kein Katastrophen-Leck mehr — gegen den Extrempunkt des Regelraums, nicht einen typischen
Gegner.
## Zwillings-Tor (Vollbudget, SEED 0x5EED_0001) — `Gate::passes` = true
```
Achse Baseline (efcff2b) soft-trust Tor-Regel
OFFENSE (pop-EV) +44.86 +50.58 haelt (+5.72) OK
BODEN (gto) -23.93 -23.93 bit-identisch OK
gto-small -21.58 -21.58 identisch
nit/maniac/fish +42.92/+45.58/+126.85 identisch unberuehrt
reg -17.66 -10.21 verbessert (nicht Boden)
EXPLOITABILITY 77.03 77.03 bit-identisch OK
```
Genau die vorhergesagte Signatur: jeder LooseAggressive/Nit/Maniac/Fish-Boden-Archetyp ist
bit-identisch (keiner klassifiziert als Grenzfall-Station), nur **reg** (der einzige Boden-Archetyp,
dessen Memory-Read an der Grenze als Station liest) und die **Offense** bewegen sich — beide nach oben.
Die Exploitability-Batterie läuft mit `villain_profile: None`, `classify` sieht nie ein echtes Profil →
bit-identisch, wie bei Leck 1. `Gate::passes`: Population hält (+5.72), Boden hält, Exploitability
steigt nicht.
## CMA-ES-Nachsuche: das lesegetriebene Loch ist zu — der Rest ist read-invariant
Die CMA-ES (`bin/nemesis`, Fast-Scan 1000×14) gegen die soft-trust-Engine findet ein **Nemesis-3**:
```
call_margin 0.396 raise_at 0.769 bet_at 0.615 open_at 0.468 bluff 0.261 size 1.148
Fast-Scan-EV −52.65 bb/100 (selektions-verzerrt nach unten, wie bei Nemesis-2: Scan fand −173, sauber −87)
```
Sauber nachgemessen (`bin/nemesis_read`, 4000) ist es ein **grundlegend anderer Befund**:
```
nemesis-3 Oracle −26.59 = Blind −26.59 = Memory −26.59 bb/100 (alle drei identisch)
konvergierter Read: vpip 0.31 pfr 0.30 fold2bet 0.79 aggr 0.47 -> classify Regular
```
**Blind ≈ Memory (exakt gleich) = ein echtes Loch, read-invariant** — das Gegenteil der lesegetriebenen
Familie (−414/−87), die dieser Fix schloss. Drei Dinge entscheiden es:
1. Nemesis-3 klassifiziert **Regular** → er wird ohnehin auf blind gegatet → die soft-trust-Änderung
(die nur CallingStation-Profile berührt) kann ihn **nicht** anfassen. Seine −26.59 sind bit-identisch
auf der pre-soft-trust- UND der pre-classify-Engine. Die CMA-ES brachte ihn nur ans Licht, weil die
lesegetriebenen Katastrophen jetzt zu sind — der Worst-Case wandert auf diesen vorbestehenden Punkt.
2. Die saubere EV ist **−26.59**, nicht −52.65 (Fast-Scan-Verzerrung, wie vorhergesagt).
3. Der Leck-Bucket (identisch in Blind und Memory): **river call −50.74** (117 Hände) gegen einen
tight-aggressiven Overbetter (vpip 0.31 ≈ pfr 0.30, size 1.148×Pot, blufft 0.261). Das ist eine
**Basis-Defense-Schwäche gegen River-Overbets**, keine Trust-Kalibrierung.
Das Loch-Schrumpfen (−414 → −87 → read-invariante −26.59) ist damit so weit, wie Trust-Kalibrierung es
bringen kann: der Rest ist die exakt vorhergesagte Struktur-Grenze — River-Defense gegen Overbets,
Domäne des opponent-aware River-Subgame-Solvers ([[engine-math-vision]] Stage A→live), **nicht** ein
weiterer Schwellen- oder Trust-Tweak. Das Zwillings-Tor schützt das Geshippte; nemesis-3 ist kein von
diesem Fix erzeugtes oder berührtes Leck.
## Werkzeug
- `src/exploit/style.rs::station_trust` — die Trust-Rampe + 4 Regressionstests.
- `src/bin/nemesis_read.rs` — EV je Lese-Modus; zeigt die Wiederherstellung zur Blind-Decke.
- `src/bin/arch_read.rs` — Boden-Archetypen Blind vs Memory; zeigt die Nicht-Regression.
- `src/bin/diag_nemesis.rs which=2` — Memory-vs-Blind-Bucket-Delta; lokalisiert den Rest-Kanal.
@@ -0,0 +1,183 @@
# Befund: der Nemesis — ein aggressiver Vielfalter, als Calling Station fehlklassifiziert
Das zweite Leck des synthetischen Labors: der CMA-ES-Nemesis (`sim::optimize::worst_case_opponent`,
`bin/nemesis`) fand den Gegner, gegen den die Engine am schlechtesten spielt — **−414 bb/100**
(Vollbudget-Lauf; mein Reproduktions-Read misst **−409.86 bb/100**). Der Brief nannte ihn einen
„klebrigen Low-Bluff-Caller, in den die Engine barrelt". Die Messung zeigt das Gegenteil: es ist kein
Over-Barrel und keine klebrige Station, sondern dieselbe Wurzel-Familie wie Leck 1 — **Preflop-Breite
übersteuert einen Read**, hier die gesamte Calling-Station-Klassifikation.
## Das Nemesis-Regelwerk (festes `Rules`)
```
call_margin 0.215 raise_at 0.587 bet_at 0.548 open_at 0.729 bluff 0.068 size 0.441
```
`call_margin` ist die Equity ÜBER den Pot-Odds, die der Gegner zum Callen verlangt (`reader.rs:47`) —
0.215 ≈ Reg (0.22), also **foldet Luft wie ein Reg**, keine Station (Fish 0.02). Zugleich **bettet er
viel** (bet_at 0.548, nahe Maniac 0.55) und **raist leicht** (raise_at 0.587 → raist ~41 % zurück, wenn
man bettet), **blufft aber fast nie** (0.068 ≈ Reg). Ein aggressiver, value-lastiger Vielfalter.
## Die entscheidende Messung: der Read ist das Gift, nicht die Hand
`bin/nemesis_read` misst die Engine-EV gegen dieses feste Regelwerk je Lese-Modus (4000 Austeilungen):
```
Oracle +81.41 bb/100 (Styled -> kein Oracle-Profil = blind)
Blind +81.41 bb/100 (kein Profil)
Memory -409.86 bb/100 (der Session-Read steht -> Katastrophe)
```
**Blind schlägt der Motor den Nemesis um +81.** Erst der aufgebaute Memory-Read kippt ihn auf −410 —
eine Spanne von **491 bb/100**, komplett lesegetrieben. (Coolers sind read-invariant; das hier ist es
nicht.)
## Die Wurzel: `classify` liest „Station" aus Preflop-Breite, gegen jeden Postflop-Befund
Der konvergierte Memory-Read des Nemesis (`bin/diag_nemesis`, 2000 Austeilungen):
```
vpip 0.53 pfr 0.14 fold2bet 0.65 aggr 0.62 -> classify CallingStation
```
`classify` stuft als CallingStation ein über den `loose`-Pfad (`vpip ≥ 0.35`), sobald der Gegner nicht
`LooseAggressive` ist (`pfr < 0.20`) — **egal, was fold_to_bet und aggression sagen**. Der Nemesis ist
breit preflop (vpip 0.53), aber er **foldet 65 %** und ist **hyper-aggressiv (0.62)** — das genaue
Gegenteil einer Station (passiv, foldet nie). Er erreicht „CallingStation" allein über die Breite.
Damit bekommt er **`earned_trust == 1.0`** (`read_gate`) — das Profil wird NICHT auf blind gegatet,
sondern voll ausgebeutet. Zwei Exploits feuern gegen den falschen Gegner:
1. **Station-Shift** (`style_shift`, CallingStation: `value_raise −0.04`, „value-bet thinner"): die
Engine value-bettet DÜNNER — in einen Gegner, der leicht zurückraist. Resultat: dünne Value-Bets
werden geraist, die Engine foldet investierte Chips (Terminal-Buckets `turn fold −152`,
`flop fold −153` im Baseline-`diag_nemesis`).
2. **Aggression-getriebener Bluff-Anteil** (`bluff_share::style_factor`): bei vorhandener aggression
gilt `aggression / 0.45`, hier `0.62 / 0.45 = 1.38×` — die Engine modelliert die value-lastige
Betting-Range des Nemesis als **über-durchschnittlich bluffig** und bluff-catcht sie ab. Der Nemesis
blufft 0.068 → die Calls verlieren (`turn call −163`, `river call −40`).
Beides ist dieselbe Verwechslung wie Leck 1: **Breite ≠ Bluff-Frequenz, und Breite ≠ Station.** Wer
breit spielt, ist nicht automatisch passiv. Nur die Postflop-Aggression trennt eine echte Station
(passiv) von einem aggressiven Vielfalter.
## Der Fix: eine Station ist loose UND passiv
`exploit::style::classify` — der `loose → CallingStation`-Pfad bekommt ein Aggressions-Tor:
```rust
const STATION_MAX_AGGRESSION: f64 = 0.45; // zwischen Reg (gemessen 0.31) und Maniac (~0.49)
let passive = aggr.is_none_or(|a| a < STATION_MAX_AGGRESSION);
...
} else if (loose && passive) || sticky {
Style::CallingStation
```
Der Nemesis (aggr 0.62) fällt aus dem `loose`-Pfad, ist nicht `sticky` (fold 0.65 > 0.30), nicht
`tight`, nicht `LooseAggressive` (pfr 0.14) → **Regular**. Regular hat `earned_trust 0` → `read_gate`
gatet ihn auf **blind**, die bewiesen sichere Grundlinie. Beide Fehl-Exploits schalten sich ab: das
Profil wird `None`, der Station-Shift entfällt, und `bluff_share` sieht `None` statt aggression 0.62.
`STATION_MAX_AGGRESSION = 0.45` liegt bewusst **über** der gemessenen Reg-Aggression (0.31) und der
echten Stations (Fish 0.11, Loose-Passiv-Test 0.0), aber **unter** dem Nemesis (0.62): die echten
Stationen bleiben Stationen, nur der aggressive Vielfalter kippt. Der `sticky`-Pfad (fold ≤ 0.30, ein
echter Nicht-Folder) bleibt aggressions-unabhängig eine Station — Nicht-Folden ist selbst das Signal.
Unbekannte aggression (`None`, noch kein Postflop-Sample) behält das alte breite Stations-Verhalten
(`is_none_or`), nichts regressiert für Profile ohne Postflop-Stichprobe.
## Beweis
**Leck geschlossen** (`bin/nemesis_read`, Memory, 4000 Austeilungen):
```
vorher nachher
Memory -409.86 -> +80.73 bb/100 (+490.59, = Blind-Decke +81.41)
classify CallingStation -> Regular
```
Die EV springt auf praktisch die Blind-Decke zurück (+80.73 vs. +81.41 blind, Rest −0.68 = Rausch:
der ungegatete MDF-Boden sieht per `raw` weiter aggression 0.62). Im `diag_nemesis` fällt die
Flop-Bet-Frequenz von 61.5 % auf 26.3 % — die Engine hört auf, dünn in die „Station" zu value-betten,
und spielt solides Blind-Poker.
**Keine Kollateralschäden an den Lese-Tests** (strukturell und gemessen):
- `tests/sim_reads.rs`: alle Oracle-Profile unverändert — CallingStation (aggr 0.02) und Fish (0.08)
bleiben Station, Maniac (pfr 0.42) bleibt LooseAggressive, Reg/Nit unverändert.
- Memory-Reads der Boden-Archetypen unverändert: Reg (aggr 0.31 < 0.45) bleibt Station, Fish (0.11)
bleibt Station, Maniac (pfr 0.21) bleibt LA, gto/gto-small (LA), Nit (tight) — **kein** Boden-Archetyp
kippt.
- 97 Lib-Tests grün (+4 neue `style`-Regressionstests), `exploit_style` 6 grün.
**Zwillings-Tor** (`twin_gate`, Vollbudget, SEED 0x5EED_0001; Baseline = efcff2b, deterministisch):
```
Achse Baseline (efcff2b) Kandidat Tor-Regel
OFFENSE (pop-EV) +44.16 +44.86 haelt (+0.70) OK
BODEN (worst) gto -23.93 gto -23.93 bit-identisch OK
gto-small -21.58 -21.58 identisch
reg/nit/maniac/fish -17.66/+42.92/+45.58/+126.85 identisch unberuehrt
EXPLOITABILITY 77.03 77.03 bit-identisch OK
```
`Gate::passes` = **true**: Population-EV hält (sogar +0.70), der Boden ist bit-identisch, die
Exploitability ist bit-identisch. Jeder Boden-Archetyp exakt wie die Baseline — wie strukturell
vorhergesagt: die Exploitability-Batterie läuft mit `villain_profile: None` → `classify` sieht nie ein
echtes Profil → **konstruktiv unverändert** (wie bei Leck 1); die Boden-Archetypen behalten ihre
Memory-Klassifikation → **unverändert**. Nur die Population-EV bewegte sich, und zwar nach oben: der
Fix kippt allein die loose + low-pfr + aggressive Draws (die Leck-Ecke) von Station auf Regular, genau
die Blutung — darum steigt die Offense leicht, statt zu fallen.
## Einordnung und was bleibt
Von −409.86 auf +80.73 bb/100 gegen den schlechtesten realistischen Gegner, den die CMA-ES finden
konnte — die Blind-Decke zurückgewonnen, ohne einen Boden- oder Exploitability-Beweis zu brechen. Es
war, wie bei Leck 1, ein lesegetriebenes Breite-als-Signal-Leck, das die Oracle-Diagnose nicht sehen
konnte (Oracle = blind für einen Styled-Gegner).
Was der Fix NICHT anfasst: der ungegatete MDF-Boden liest per `raw` weiter die rohe aggression 0.62 →
`over_bluffs` (aggression ≥ 0.45, Leck 1) feuert auf dem River, kostet aber nur den ~0.68-bb-Rest
gegen die Blind-Decke — innerhalb des Rauschens, kein eigenes Leck. Die Spannung „aggression hilft vs.
Maniac, schadet vs. aggressivem Value-Better" lebt im River-MDF-Boden und gehört, falls je relevant, in
den opponent-aware, trust-gegateten River-Subgame-Solver ([[engine-math-vision]] Stage A→live), nicht
in einen weiteren Schwellen-Tweak.
**Leck 3 (Live-Gap −311)** bleibt unberührt: es braucht operative Live-Farm-Daten, keinen
Code-Fix, den das Labor schließen kann.
## Robustheits-Nachsuche: das Loch schrumpft, der Rest ist die Trust-Struktur
Der Fix patcht nicht einen Punkt — die CMA-ES (`bin/nemesis`, jetzt mit `[deals] [generations]`
argv) gegen die REPARIERTE Engine neu laufen lassen zeigt, wie weit die kontinuierliche Robustheits-
Lücke zugeht:
```
vor dem Fix Nemesis-1 -414 bb/100 (Vollbudget) / -409.86 (Memory, 4000)
nach dem Fix Nemesis-2 -87.63 bb/100 (Memory, 4000; Schnellscan 400x8 fand -173, selektions-
verzerrt nach unten)
```
Nemesis-2 (`call_margin 0.173, raise_at 0.579, bet_at 0.748, open_at 0.800, bluff 0.229, size 0.996`)
ist **dasselbe lesegetriebene Leck**: Blind **+114.01**, Memory **−87.63** (`bin/nemesis_read`). Sein
konvergierter Read `vpip 0.65 pfr 0.15 fold2bet 0.56 aggr 0.41` → **classify CallingStation** — die
Aggression 0.41 liegt **knapp unter** dem 0.45-Tor, also rutscht er zurück in die getrustete Station.
Buckets wie bei Nemesis-1 (turn call −109, river/flop fold).
**Warum kein weiterer Schwellen-Tweak:** das Tor tiefer zu legen (z. B. 0.40), um aggr 0.41 zu fangen,
quetscht den Reg-Archetyp (gemessene Aggression 0.31 — nur 0.10 entfernt, Memory-Rauschen überlappt)
und die CMA-ES findet dann ein Nemesis-3 bei aggr 0.33. Die Wurzel ist das **binäre `earned_trust`**
(1.0 für CallingStation, 0.0 sonst): ein Gegner direkt an der Klassengrenze bekommt den vollen
Station-Exploit oder gar keinen. `read_gate` nennt das selbst als nächsten Schritt — „The value is an
f64, not a bool, to leave room for a partial, confidence-weighted trust later without changing this
seam." Das ist die saubere Lösung: Trust als Konfidenz, die den Exploit skaliert (Grenzfall → partiell),
plus der opponent-aware Range-Posterior, der die value-lastige Betting-Range direkt misst statt sie aus
`aggression/0.45` zu schätzen ([[engine-math-vision]]). Ein 0.01-Margin-Tweak ist das nicht wert — das
Zwillings-Tor schützt das Geshippte, und Nemesis-2 (−87, gegen den EXTREMPUNKT des Regelraums, kein
typischer Gegner) ist kein Katastrophen-Leck mehr, sondern die Struktur-Grenze der Heuristik.
## Werkzeug
- `src/bin/diag_nemesis.rs` — konvergierter Memory-Read + classify, Terminal-Bucket-Attribution
(aggressive vs. passive Seite) gegen das feste Nemesis-Regelwerk.
- `src/bin/nemesis_read.rs` — Nemesis-EV je Lese-Modus (Oracle/Blind/Memory): zeigt die Read-Lücke
und die Wiederherstellung auf die Blind-Decke.
+38
View File
@@ -0,0 +1,38 @@
//! Per-archetype Blind vs Memory EV: does acting on the (station) read HELP or HURT each archetype?
//! This decides whether softening the binary CallingStation trust is safe. If Memory ≥ Blind the read
//! is a net gain (keep trust high); if Memory < Blind the station exploit is already costing and
//! softening helps. Prints the gap = Memory − Blind.
//!
//! Run: `cargo run --release --bin arch_read [deals]` (default 4000; fast threshold styles only —
//! gto/gto-small run a per-decision solver and are covered by the twin gate).
use rechner::exploit::style::classify;
use rechner::sim::opponent::Opponent;
use rechner::sim::reader::Style;
use rechner::sim::reads::opponent_profile;
use rechner::sim::session::{measure, ReadMode, Setup};
const SEED: u64 = 0x5EED_0001;
const STACK_BB: f64 = 100.0;
fn ev(style: Style, read: ReadMode, deals: u32) -> f64 {
let setup =
Setup { players: 2, opponent: Opponent::Reader(style), deals, stack_bb: STACK_BB, seed: SEED, read };
measure(&setup).bb_per_100
}
fn main() {
let deals: u32 = std::env::args().nth(1).and_then(|s| s.parse().ok()).unwrap_or(4000);
println!("=== Archetyp Blind vs Memory, {deals} Austeilungen ===");
println!("gap = Memory - Blind (>0: Read nuetzt, <0: Station-Exploit kostet schon)\n");
println!(" {:<8} {:>9} {:>9} {:>9} {}", "style", "blind", "memory", "gap", "oracle-classify");
for style in [Style::Fish, Style::Reg, Style::Nit, Style::Maniac] {
let blind = ev(style, ReadMode::Blind, deals);
let memory = ev(style, ReadMode::Memory, deals);
let oc = opponent_profile(Opponent::Reader(style)).map(|p| format!("{:?}", classify(&p)));
println!(
" {:<8} {:>+9.2} {:>+9.2} {:>+9.2} {}",
style.name(), blind, memory, memory - blind, oc.unwrap_or_else(|| "-".into())
);
}
}
+195
View File
@@ -0,0 +1,195 @@
//! Diagnose WHERE the engine bleeds against its NEMESIS — the sticky low-bluff calling station the
//! CMA-ES found (`sim::optimize::worst_case_opponent`, −414 bb/100). The nemesis ruleset is a fixed
//! `Rules`: call_margin 0.215 (calls very wide), bluff 0.068 (almost never bluffs), size 0.441. It
//! rarely folds and rarely bluffs, so barreling into it has no fold equity — the engine should check
//! back / give up, not bluff.
//!
//! Mirrors `diag_gto`'s traced attribution, but (a) the opponent is the explicit nemesis `Rules`,
//! (b) the read is the realistic converged Memory snapshot (the lab measures the nemesis under Memory),
//! and (c) the drill is on the AGGRESSIVE side (hero bet/raise buckets, bluff-into-station), because
//! this is the over-barrel mirror of the GTO over-defense leak.
//!
//! Run: `cargo run --release --bin diag_nemesis [deals]`.
use rechner::exploit::style::classify;
use rechner::game::{Choice, Street};
use rechner::rng::Rng;
use rechner::sim::memory::SessionMemory;
use rechner::sim::opponent::Opponent;
use rechner::sim::reader::Rules;
use rechner::sim::table::{deal, play_hand_tracked, play_hand_traced, HandRead, HandSetup, TableCost};
use std::collections::BTreeMap;
const SEED: u64 = 0x5EED_0001;
const STACK_BB: f64 = 100.0;
const PLAYERS: usize = 2;
/// The original nemesis ruleset (full-budget run vs the pre-fix engine).
const NEMESIS: Rules = Rules {
call_margin: 0.215,
raise_at: 0.587,
bet_at: 0.548,
open_at: 0.729,
bluff: 0.068,
size: 0.441,
};
/// The new worst case the CMA-ES finds against the FIXED engine (fast scan). Also read-driven
/// (Blind +114, Memory −87).
const NEMESIS2: Rules = Rules {
call_margin: 0.173,
raise_at: 0.579,
bet_at: 0.748,
open_at: 0.800,
bluff: 0.229,
size: 0.996,
};
/// The worst case the CMA-ES finds against the SOFT-TRUST engine (fast scan, −52.65 bb/100): folds air
/// hard (call_margin 0.396), opens very wide (0.468), rarely raises, overbets (size 1.148).
const NEMESIS3: Rules = Rules {
call_margin: 0.396,
raise_at: 0.769,
bet_at: 0.615,
open_at: 0.468,
bluff: 0.261,
size: 1.148,
};
fn mix(seed: u64, n: u64) -> u64 {
Rng::seeded(seed ^ n.wrapping_mul(0xD1B5_4A32_D192_ED03)).next_u64().0
}
fn street_name(s: Street) -> &'static str {
match s {
Street::Preflop => "preflop",
Street::Flop => "flop",
Street::Turn => "turn",
Street::River => "river",
}
}
fn choice_name(c: Choice) -> &'static str {
match c {
Choice::Fold => "fold",
Choice::Check => "check",
Choice::Call => "call",
Choice::Raise { .. } => "raise/bet",
Choice::Abstain => "abstain",
}
}
#[derive(Default, Clone, Copy)]
struct Agg {
hands: u32,
net: f64,
}
impl Agg {
fn add(&mut self, net: f64) {
self.hands += 1;
self.net += net;
}
}
fn contrib(net: f64, total_hands: u32) -> f64 {
100.0 * net / total_hands.max(1) as f64
}
/// Trace all deals under one fixed read; return (total, terminal buckets by (street, action)).
fn run(opponent: Opponent, deals: u32, read: Option<rechner::exploit::profile::Profile>)
-> (Agg, BTreeMap<(Street, &'static str), Agg>) {
let mut total = Agg::default();
let mut by_terminal: BTreeMap<(Street, &'static str), Agg> = BTreeMap::new();
for d in 0..deals {
let (cards, _) = deal(PLAYERS, Rng::seeded(mix(SEED, d as u64)));
for hero_seat in 1..=PLAYERS as u8 {
let hand = HandSetup {
deal: &cards,
hero_seat,
opponent,
stack_bb: STACK_BB,
seed: mix(SEED ^ 0xA5A5, (d as u64) << 8 | hero_seat as u64),
read: HandRead::Given(read),
};
let (res, trace) = play_hand_traced(&hand, TableCost::FREE);
let net = res.hero_net - res.luck; // luck-corrected
total.add(net);
if let Some(last) = trace.last() {
by_terminal.entry((last.street, choice_name(last.choice))).or_default().add(net);
}
}
}
(total, by_terminal)
}
fn main() {
let deals: u32 = std::env::args().nth(1).and_then(|s| s.parse().ok()).unwrap_or(2000);
let which: u32 = std::env::args().nth(2).and_then(|s| s.parse().ok()).unwrap_or(1);
let opponent = Opponent::Styled(match which {
3 => NEMESIS3,
2 => NEMESIS2,
_ => NEMESIS,
});
// --- Pass 1: converge the Memory read exactly as session::deal_samples does. ---
let mut memory = SessionMemory::new();
for d in 0..deals {
let (cards, _) = deal(PLAYERS, Rng::seeded(mix(SEED, d as u64)));
for hero_seat in 1..=PLAYERS as u8 {
let hand = HandSetup {
deal: &cards,
hero_seat,
opponent,
stack_bb: STACK_BB,
seed: mix(SEED ^ 0xA5A5, (d as u64) << 8 | hero_seat as u64),
read: HandRead::Given(memory.read()),
};
play_hand_tracked(&hand, TableCost::FREE, Some(&mut memory));
}
}
let read = memory.read();
println!("=== Nemesis-Diagnose (Memory vs Blind): {deals} Austeilungen ===\n");
print!("-- konvergierter Read des Nemesis: ");
match read {
None => println!("kein Read"),
Some(p) => println!(
"vpip {:.2} pfr {:.2} fold2bet {:.2} aggr {:.2} -> classify {:?}",
p.vpip.unwrap_or(f64::NAN), p.pfr.unwrap_or(f64::NAN),
p.fold_to_bet.unwrap_or(f64::NAN), p.aggression.unwrap_or(f64::NAN), classify(&p),
),
}
// --- Pass 2+3: same deals under the converged Memory read and under blind (None). ---
let (mem_total, mem_buckets) = run(opponent, deals, read);
let (blind_total, blind_buckets) = run(opponent, deals, None);
let h = mem_total.hands;
println!(
"\n-- gesamt: Memory {:+.2} vs Blind {:+.2} bb/100 (Delta {:+.2}, {} Haende) --",
contrib(mem_total.net, h), contrib(blind_total.net, h),
contrib(mem_total.net - blind_total.net, h), h
);
// Per terminal bucket: Memory, Blind, and the Memory−Blind delta (the leak per bucket), sorted by
// the delta (most-costly read-driven bucket first).
let mut keys: std::collections::BTreeSet<(Street, &'static str)> = std::collections::BTreeSet::new();
keys.extend(mem_buckets.keys().copied());
keys.extend(blind_buckets.keys().copied());
let get = |m: &BTreeMap<(Street, &'static str), Agg>, k: &(Street, &'static str)| {
m.get(k).copied().unwrap_or_default()
};
let mut rows: Vec<_> = keys.into_iter().map(|k| {
let (m, b) = (get(&mem_buckets, &k), get(&blind_buckets, &k));
(k, contrib(m.net, h), contrib(b.net, h), contrib(m.net - b.net, h), m.hands, b.hands)
}).collect();
rows.sort_by(|a, b| a.3.partial_cmp(&b.3).unwrap());
println!("\n-- nach terminaler Entscheidung: Memory vs Blind (Delta = Leck je Bucket) --");
println!(" {:<18} {:>10} {:>10} {:>10} {:>8} {:>8}", "bucket", "mem", "blind", "DELTA", "mem#", "blind#");
for ((s, act), m, b, delta, mh, bh) in rows {
println!(
" {:<18} {:>+10.2} {:>+10.2} {:>+10.2} {:>8} {:>8}",
format!("{} {}", street_name(s), act), m, b, delta, mh, bh
);
}
}
+6 -3
View File
@@ -12,15 +12,18 @@ use rechner::sim::optimize::worst_case_opponent;
const SEED: u64 = 0x5EED_0001;
// Higher budget now that the λ-evaluations run in parallel: more deals per evaluation tightens the
// nemesis EV, more generations let the CMA-ES converge further into the worst-case region.
// nemesis EV, more generations let the CMA-ES converge further into the worst-case region. Overridable
// from argv (`nemesis [deals] [generations]`) for a fast scan before the full-budget confirmation.
const DEALS: u32 = 1000;
const GENERATIONS: u32 = 14;
fn main() {
let deals: u32 = std::env::args().nth(1).and_then(|s| s.parse().ok()).unwrap_or(DEALS);
let generations: u32 = std::env::args().nth(2).and_then(|s| s.parse().ok()).unwrap_or(GENERATIONS);
println!("=== Stufe 5: der Nemesis — schlechtester Gegner der Engine (CMA-ES ueber den Regelraum) ===");
println!("{DEALS} Austeilungen je Auswertung, {GENERATIONS} Generationen, Memory-Read.\n");
println!("{deals} Austeilungen je Auswertung, {generations} Generationen, Memory-Read.\n");
let (r, ev) = worst_case_opponent(DEALS, GENERATIONS, SEED);
let (r, ev) = worst_case_opponent(deals, generations, SEED);
println!("Nemesis-Regelwerk (realistische Schranken):");
println!(" call_margin {:.3} raise_at {:.3} bet_at {:.3}", r.call_margin, r.raise_at, r.bet_at);
+80
View File
@@ -0,0 +1,80 @@
//! Is the nemesis leak read-driven? Measure the engine's EV vs the fixed nemesis ruleset under each
//! read mode. If Blind >> Memory, the catastrophe is the TRUSTED CallingStation read (vpip 0.53 trips
//! the `loose -> CallingStation` path, earned_trust 1.0), and gating the nemesis to blind — by making
//! `classify` require a station to be postflop-passive, so this aggressive frequent-folder reads
//! Regular — recovers it toward the Blind ceiling.
//!
//! Run: `cargo run --release --bin nemesis_read [deals]`.
use rechner::exploit::style::classify;
use rechner::sim::opponent::Opponent;
use rechner::sim::reader::Rules;
use rechner::sim::session::{measure, ReadMode, Setup};
const SEED: u64 = 0x5EED_0001;
const STACK_BB: f64 = 100.0;
/// The original CMA-ES nemesis (full-budget, vs the pre-fix engine): a reg-tight low-bluff caller
/// that bet a lot and raised light. Fixed via the station-aggression gate (classify reads it Regular).
const NEMESIS: Rules = Rules {
call_margin: 0.215,
raise_at: 0.587,
bet_at: 0.548,
open_at: 0.729,
bluff: 0.068,
size: 0.441,
};
/// The NEW worst case the CMA-ES finds against the FIXED engine (fast scan 400x8, −173 bb/100): bets
/// tighter (0.748) but big (size ~pot), raises light (0.579), and actually bluffs (0.229).
const NEMESIS2: Rules = Rules {
call_margin: 0.173,
raise_at: 0.579,
bet_at: 0.748,
open_at: 0.800,
bluff: 0.229,
size: 0.996,
};
/// The worst case the CMA-ES finds against the SOFT-TRUST engine (fast scan 1000x14, −52.65 bb/100):
/// a different shape — folds air hard (call_margin 0.396), opens very wide (0.468), rarely raises
/// (0.769), overbets (size 1.148). Probe: is it the same read-driven family or a genuine hole?
const NEMESIS3: Rules = Rules {
call_margin: 0.396,
raise_at: 0.769,
bet_at: 0.615,
open_at: 0.468,
bluff: 0.261,
size: 1.148,
};
fn main() {
let deals: u32 = std::env::args().nth(1).and_then(|s| s.parse().ok()).unwrap_or(4000);
println!("=== Nemesis je Lese-Modus, {deals} Austeilungen ===");
println!("Blind >> Memory => lesegetriebenes Leck (Fehlklassifikation). Blind ~= Memory => echtes Loch.\n");
for (name, rules) in [("nemesis-1", NEMESIS), ("nemesis-2", NEMESIS2), ("nemesis-3", NEMESIS3)] {
println!("-- {name}: call_margin {:.3} raise_at {:.3} bet_at {:.3} open_at {:.3} bluff {:.3} size {:.3}",
rules.call_margin, rules.raise_at, rules.bet_at, rules.open_at, rules.bluff, rules.size);
for read in [ReadMode::Oracle, ReadMode::Blind, ReadMode::Memory] {
let setup = Setup {
players: 2,
opponent: Opponent::Styled(rules),
deals,
stack_bb: STACK_BB,
seed: SEED,
read,
};
let m = measure(&setup);
println!(" {:<7} {:>+9.2} bb/100 ±{:>5.2}", format!("{read:?}"), m.bb_per_100, m.ci95);
}
println!();
}
let p = rechner::exploit::profile::Profile {
vpip: Some(0.53),
pfr: Some(0.14),
fold_to_bet: Some(0.65),
aggression: Some(0.62),
..Default::default()
};
println!(" classify(nemesis-1-read vpip0.53 pfr0.14 fold0.65 aggr0.62) = {:?}", classify(&p));
}
+11 -5
View File
@@ -1,6 +1,6 @@
use super::fold_equity_scale::{MAX_SCALE, MIN_SCALE};
use super::profile::Profile;
use super::style::classify;
use super::style::{classify, station_trust, Style};
use super::style_shift::shift_for;
use super::thresholds::Thresholds;
@@ -19,13 +19,19 @@ fn bounded(x: f64, (low, high): (f64, f64)) -> f64 {
}
/// `base` as seen against one profile; `None` when the profile says nothing.
///
/// A `CallingStation` shift is scaled by `station_trust`: a misclassified aggressive "station"
/// (loose width but postflop-aggressive — nemesis-2) gets a fraction of the value-bet-thinner shift,
/// not all of it. Every other style, and a genuine station (trust 1.0), is bit-identical to before.
fn against(base: Thresholds, profile: &Profile) -> Option<Thresholds> {
shift_for(classify(profile)).map(|shift| Thresholds {
call_margin: bounded(base.call_margin + shift.call_margin, CALL_MARGIN),
value_raise: bounded(base.value_raise + shift.value_raise, VALUE_RAISE),
let style = classify(profile);
let c = if style == Style::CallingStation { station_trust(profile) } else { 1.0 };
shift_for(style).map(|shift| Thresholds {
call_margin: bounded(base.call_margin + shift.call_margin * c, CALL_MARGIN),
value_raise: bounded(base.value_raise + shift.value_raise * c, VALUE_RAISE),
abstain_band: bounded(base.abstain_band, ABSTAIN_BAND),
fold_equity_scale: base.fold_equity_scale.clamp(MIN_SCALE, MAX_SCALE),
range_width_scale: bounded(base.range_width_scale * shift.range_width, RANGE_WIDTH),
range_width_scale: bounded(base.range_width_scale * (1.0 + (shift.range_width - 1.0) * c), RANGE_WIDTH),
})
}
+17 -5
View File
@@ -11,7 +11,7 @@
//! (`table_fold::pressure_ratio`).
use super::profile::Profile;
use super::style::{classify, Style};
use super::style::{classify, station_trust, Style};
/// Bet size (pot fraction) at which foldToBet is taken to be measured.
pub const REFERENCE_RATIO: f64 = 0.66;
@@ -32,13 +32,25 @@ fn style_default(style: Style) -> f64 {
}
/// The opponent's fold-to-bet at the reference size.
///
/// A `CallingStation` read is trust-weighted (`station_trust`): a misclassified aggressive "station"
/// (nemesis-2, fold-to-bet 0.56 read, aggr 0.41) only partly trusts its high fold frequency, so hero
/// does not over-barrel into a light-raising range whose multi-street cost the single-street bluff-EV
/// never models. A genuine station (trust 1.0) is bit-identical to the raw read.
pub fn fold_base(profile: Option<&Profile>) -> f64 {
match profile {
None => DEFAULT_FOLD_TO_BET,
Some(p) => match p.fold_to_bet.filter(|f| !f.is_nan()) {
Some(f) => f.clamp(0.0, 1.0),
None => style_default(classify(p)),
},
Some(p) => {
let raw = match p.fold_to_bet.filter(|f| !f.is_nan()) {
Some(f) => f.clamp(0.0, 1.0),
None => style_default(classify(p)),
};
if classify(p) == Style::CallingStation {
DEFAULT_FOLD_TO_BET + station_trust(p) * (raw - DEFAULT_FOLD_TO_BET)
} else {
raw
}
}
}
}
+27 -3
View File
@@ -5,24 +5,48 @@ use super::range_spec::RangeSpec;
use super::role_band::role_band;
use super::role_from_history::role_of;
use super::street_continuation::continuations;
use super::style::{classify, station_trust, Style};
use crate::game::{Spot, Villain};
use crate::preflop::seat_position::seat_position;
/// Without a readable preflop role the band is the plain vpip share.
/// Confidence weight for how much this villain's read may widen the modeled range: `1.0` for every
/// non-station and every genuine station (bit-identical to the binary gate), a fraction for a
/// misclassified aggressive "station" (loose width but postflop-aggressive — the CMA-ES nemesis-2,
/// aggr 0.41 → 0.16). A wide `vpip` read only widens the modeled betting range as far as the read is
/// trusted, so a wide-preflop-but-TIGHT-betting opponent is no longer modeled as an over-weak range
/// the engine then over-calls. See `station_trust` and BEFUND-nemesis-soft-trust.
fn range_trust(villain: &Villain) -> f64 {
match villain.profile.as_ref() {
Some(p) if classify(p) == Style::CallingStation => station_trust(p),
_ => 1.0,
}
}
/// Pull a read-driven value `x` toward its blind baseline by trust `c`: full read at `c = 1`, pure
/// blind at `c = 0`.
fn toward_blind(blind: f64, x: f64, c: f64) -> f64 {
blind + c * (x - blind)
}
/// Without a readable preflop role the band is the plain vpip share — trust-blended toward the
/// default (blind) vpip so a low-trust station does not over-widen the band.
fn unknown_role_band(villain: &Villain) -> (f64, f64) {
let vpip = villain
.profile
.and_then(|p| p.vpip)
.filter(|v| !v.is_nan())
.map_or(DEFAULT_VPIP, |v| v.clamp(0.02, 1.0));
(0.0, vpip)
(0.0, toward_blind(DEFAULT_VPIP, vpip, range_trust(villain)))
}
fn preflop_band(spot: &Spot, villain: &Villain) -> (f64, f64) {
match role_of(&spot.history, villain.seat) {
Some(role) => {
let (lo, hi) = role_band(spot, role, seat_position(spot, villain.seat));
stretched(lo, hi, stretch(role, villain.profile))
// The read stretches the band by the villain's looseness; blind stretch is 1.0. Trust
// scales how far the band is stretched, so a misread station's wide vpip barely widens it.
let factor = toward_blind(1.0, stretch(role, villain.profile), range_trust(villain));
stretched(lo, hi, factor)
}
None => unknown_role_band(villain),
}
+137 -4
View File
@@ -24,25 +24,47 @@ const NIT_FOLD_TO_BET: f64 = 0.65;
const NIT_MAX_VPIP_WITH_FOLDS: f64 = 0.25;
const STATION_FOLD_TO_BET: f64 = 0.30;
const STATION_MIN_VPIP: f64 = 0.28;
/// A calling station is loose AND postflop-passive. Above this postflop aggression frequency a
/// loose-but-not-raising player is not a station — it only looks loose preflop. Sits between the
/// reg archetype's measured 0.31 and the maniac's ~0.49; the CMA-ES nemesis measures 0.62. See the
/// `an_aggressive_loose_folder_is_not_a_station` regression test and BEFUND-nemesis-station-fehllabel.
const STATION_MAX_AGGRESSION: f64 = 0.45;
/// At or below this postflop aggression a loose-path station is trusted in FULL (`station_trust`
/// 1.0). Between here and `STATION_MAX_AGGRESSION` the station exploit is scaled down linearly — a
/// confidence ramp, not a cliff. Set above the real stations (fish 0.11, oracle 0.02) so they stay
/// bit-identical, and below the reg archetype (0.31) so a misread aggressive "station" (nemesis-2
/// aggr 0.41 → trust 0.16) barely exploits. See `station_trust` and BEFUND-nemesis-soft-trust.
const STATION_FULL_TRUST_AGGRESSION: f64 = 0.20;
/// A frequency in `[0, 1]`; NaN means "not known".
fn frequency(x: Option<f64>) -> Option<f64> {
x.filter(|v| !v.is_nan()).map(|v| v.clamp(0.0, 1.0))
}
/// Thresholds (vpip/pfr/foldToBet are all clamped to `[0, 1]` first, NaN counts as missing):
/// Thresholds (vpip/pfr/foldToBet/aggression are all clamped to `[0, 1]` first, NaN counts as missing):
/// - all missing: `Unknown`
/// - vpip >= 35 % and pfr >= 20 %: `LooseAggressive`
/// - vpip >= 35 % otherwise, or foldToBet <= 30 % with vpip >= 28 % (or unknown): `CallingStation`
/// - (vpip >= 35 % AND aggression < 45 % or unknown), or foldToBet <= 30 % with vpip >= 28 % (or
/// unknown): `CallingStation`
/// - vpip <= 15 %, or foldToBet >= 65 % with vpip <= 25 % (or unknown): `Nit`
/// - else `Regular`
///
/// A station is loose AND passive: the `loose` → `CallingStation` path is gated on postflop
/// aggression (`STATION_MAX_AGGRESSION`) so a loose-preflop but aggression-heavy frequent-folder
/// (the CMA-ES nemesis: vpip 0.53, pfr 0.14, foldToBet 0.65, aggression 0.62) reads `Regular` — gated
/// to blind by `read_gate`, the proven-safe baseline — instead of being handed `earned_trust 1.0`
/// and the station exploit it then bled −448 bb/100 to. The `sticky` path (fold ≤ 30 %) is a real
/// non-folder and stays a station regardless of aggression.
pub fn classify(profile: &Profile) -> Style {
let (vpip, pfr, fold) = (
let (vpip, pfr, fold, aggr) = (
frequency(profile.vpip),
frequency(profile.pfr),
frequency(profile.fold_to_bet),
frequency(profile.aggression),
);
let loose = vpip.is_some_and(|v| v >= LOOSE_VPIP);
// Postflop-passive: a station does not fire back. Unknown aggression keeps the old behaviour.
let passive = aggr.is_none_or(|a| a < STATION_MAX_AGGRESSION);
let sticky = fold.is_some_and(|b| b <= STATION_FOLD_TO_BET)
&& vpip.is_none_or(|v| v >= STATION_MIN_VPIP);
let tight = vpip.is_some_and(|v| v <= NIT_VPIP)
@@ -52,7 +74,7 @@ pub fn classify(profile: &Profile) -> Style {
Style::Unknown
} else if loose && pfr.is_some_and(|f| f >= AGGRESSIVE_PFR) {
Style::LooseAggressive
} else if loose || sticky {
} else if (loose && passive) || sticky {
Style::CallingStation
} else if tight {
Style::Nit
@@ -60,3 +82,114 @@ pub fn classify(profile: &Profile) -> Style {
Style::Regular
}
}
/// How much to trust a `CallingStation` read, in `[0, 1]` — the confidence-weighted generalization
/// of the binary `earned_trust` gate (`engine::read_gate` keeps a station's profile or drops it; this
/// says HOW MUCH of the station exploit to apply to what it keeps). Only meaningful for a profile
/// that already classifies `CallingStation`; the station-exploit channels (`adjust`'s value shift,
/// `style_rung`'s made-floor rung) scale their deviation from blind by this weight.
///
/// A station earns full trust on either signal: it does not fold (sticky, `fold_to_bet` ≤ 30 %) —
/// value-betting it thin is always right — OR it is postflop-passive (low `aggression`). The
/// aggression ramp governs only the loose-WIDTH path, where a high `vpip` alone made the old binary
/// gate hand full trust to aggressive frequent-folders (the CMA-ES nemesis-2, aggr 0.41, folds 56 %)
/// that then bled to the over-call. Unknown aggression keeps the old full trust (no postflop sample
/// to doubt). A genuine station (fish, oracle) returns exactly `1.0` → bit-identical to the old gate.
pub fn station_trust(profile: &Profile) -> f64 {
// A real non-folder is a station on the strongest signal; aggression does not weaken that.
if frequency(profile.fold_to_bet).is_some_and(|b| b <= STATION_FOLD_TO_BET) {
return 1.0;
}
match frequency(profile.aggression) {
None => 1.0,
Some(a) => ((STATION_MAX_AGGRESSION - a)
/ (STATION_MAX_AGGRESSION - STATION_FULL_TRUST_AGGRESSION))
.clamp(0.0, 1.0),
}
}
#[cfg(test)]
mod tests {
use super::*;
fn profile(vpip: f64, pfr: f64, fold: f64, aggr: f64) -> Profile {
Profile {
vpip: Some(vpip),
pfr: Some(pfr),
fold_to_bet: Some(fold),
aggression: Some(aggr),
..Profile::default()
}
}
/// The CMA-ES nemesis read: loose preflop (vpip 0.53) but a hyper-aggressive frequent-folder
/// (aggression 0.62, foldToBet 0.65). Width alone made the old `loose` path label it a station,
/// handing it earned_trust and the station exploit it bled −448 bb/100 to. It must read `Regular`
/// (gated to blind), not `CallingStation`.
#[test]
fn an_aggressive_loose_folder_is_not_a_station() {
let p = profile(0.53, 0.14, 0.65, 0.62);
assert_eq!(classify(&p), Style::Regular);
}
/// A genuinely loose-passive opponent (low aggression) is still a `CallingStation` — the fix
/// gates on aggression, not on preflop width, so the real station is untouched.
#[test]
fn a_loose_passive_opponent_is_still_a_station() {
let p = profile(0.70, 0.05, 0.25, 0.10);
assert_eq!(classify(&p), Style::CallingStation);
}
/// A sticky non-folder (foldToBet ≤ 30 %) stays a station regardless of aggression — not folding
/// is itself the station signal; the aggression gate applies only to the `loose` path.
#[test]
fn a_sticky_non_folder_stays_a_station_even_if_aggressive() {
let p = profile(0.40, 0.10, 0.20, 0.60);
assert_eq!(classify(&p), Style::CallingStation);
}
/// Aggression unknown (not yet measured) keeps the old width-based station read, so nothing
/// regresses for profiles without a postflop sample.
#[test]
fn unknown_aggression_keeps_the_width_based_station() {
let p = Profile { vpip: Some(0.50), pfr: Some(0.10), fold_to_bet: Some(0.45), ..Profile::default() };
assert_eq!(classify(&p), Style::CallingStation);
}
/// A genuine passive station (fish: aggr 0.11) and a non-folder earn FULL trust — the soft gate
/// is bit-identical to the old binary gate for the stations that were always right to exploit.
#[test]
fn a_passive_station_earns_full_trust() {
let fish = profile(0.55, 0.08, 0.40, 0.11); // loose path (folds 40 %), very passive
assert_eq!(station_trust(&fish), 1.0);
let non_folder = profile(0.40, 0.10, 0.20, 0.60); // sticky: never folds → full trust despite aggression
assert_eq!(station_trust(&non_folder), 1.0);
}
/// A misclassified aggressive loose "station" (nemesis-2: loose width, folds 56 %, aggr 0.41)
/// earns only a sliver of trust, so the station exploit barely fires on it.
#[test]
fn a_misread_aggressive_station_earns_little_trust() {
let nemesis2 = profile(0.65, 0.15, 0.56, 0.41);
let c = station_trust(&nemesis2);
assert!(c > 0.0 && c < 0.25, "expected a small trust, got {c}");
}
/// Trust falls monotonically as the loose-path station gets more aggressive, reaching 0 at the
/// classify boundary — a smooth handoff to `Regular` (gated blind), no cliff.
#[test]
fn loose_station_trust_ramps_down_with_aggression() {
let at = |a: f64| station_trust(&profile(0.55, 0.10, 0.50, a));
assert_eq!(at(0.20), 1.0);
assert!((at(0.325) - 0.5).abs() < 1e-9);
assert_eq!(at(0.45), 0.0);
assert!(at(0.25) > at(0.35));
}
/// Unknown aggression keeps full trust: no postflop sample is no reason to doubt the read.
#[test]
fn unknown_aggression_keeps_full_station_trust() {
let p = Profile { vpip: Some(0.50), pfr: Some(0.10), fold_to_bet: Some(0.45), ..Profile::default() };
assert_eq!(station_trust(&p), 1.0);
}
}
+11 -4
View File
@@ -1,12 +1,19 @@
use super::style::{classify, Style};
use super::style::{classify, station_trust, Style};
use crate::game::Villain;
/// How a villain's style moves a made-hand floor on `made_ladder`: looser styles
/// (calling station, loose-aggressive) one rung down, the nit one up.
///
/// The station's `-1` rung (model its bets one rung weaker → bluff-catch wider) is confidence-gated:
/// it fires only for a genuinely passive station (`station_trust` ≥ 0.5). A misclassified aggressive
/// "station" (nemesis-2, aggr 0.41 → trust 0.16) keeps the blind made-floor and is not over-called.
/// A genuine passive station / non-folder (trust 1.0) rounds to `-1`, bit-identical to before.
pub fn style_rung(villain: &Villain) -> i32 {
match villain.profile.map(|p| classify(&p)) {
Some(Style::CallingStation | Style::LooseAggressive) => -1,
Some(Style::Nit) => 1,
let Some(profile) = villain.profile.as_ref() else { return 0 };
match classify(profile) {
Style::CallingStation => -(station_trust(profile).round() as i32),
Style::LooseAggressive => -1,
Style::Nit => 1,
_ => 0,
}
}