From 031c550014c5b3a8bd614612e5eb69f157a10230 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Wed, 18 Nov 2026 18:00:02 +0100 Subject: [PATCH] Pruefstand: Vetos in der Begruendung, POSTERIOR auf echten Spots, Kandidaten fluss/ENTHALTUNG, Werkzeuge tor_echt + kippliste - vermerk.rs: jede Regel, die eine Aktion nach der Grundrechnung ueberstimmt, haengt sich an reason; bitgleich auf 48 672 Anfragen (0 Abweichungen ausser reason) - POSTERIOR=...,fluss (S2 nur am River): echte NL2-Spots holdout +53 276 bb eq; Tor wegen Pflichtfall offen - ENTHALTUNG=passiv: gehaltener Raise im Fehler -> beste passive Linie statt ABSTAIN (Laeufer foldete +EV-Calls) - livefaelle: Kommawerte (POSTERIOR=bluff,schutz,beleg) wurden abgeschnitten - Alle neuen Schalter aus = Live-Stand bitgleich; nichts live geschaltet Co-Authored-By: Claude Opus 5.5 --- .gitignore | 6 + entscheiden/decide.py | 2 +- messung/pruefstand/POSTERIOR.md | 77 + messung/pruefstand/bitgleich.py | 67 + messung/pruefstand/post-holdout.sha256 | 1 + messung/pruefstand/posterior-dev.json | 1443 ++++++++++++++++ messung/pruefstand/posterior-holdout.json | 1461 +++++++++++++++++ messung/pruefstand/posterior_bewerten.py | 105 ++ messung/pruefstand/posterior_spots.py | 50 + messung/pruefstand/tor/posterior-fluss/TOR.md | 32 + .../tor/posterior-fluss/lbr-arm.txt | 40 + .../tor/posterior-fluss/lbr-live.txt | 40 + .../pruefstand/tor/posterior-fluss/tor.json | 342 ++++ src/engine/bluff.rs | 30 + src/engine/decide.rs | 26 +- src/engine/from_plan.rs | 15 +- src/engine/glaube.rs | 24 +- src/engine/mod.rs | 1 + src/engine/options.rs | 55 +- src/engine/postflop.rs | 26 + src/engine/vermerk.rs | 107 ++ src/exploit/street_continuation.rs | 2 +- werkzeuge/kippliste.py | 494 ++++++ werkzeuge/livefaelle.py | 15 +- werkzeuge/tor_echt.py | 411 +++++ 25 files changed, 4854 insertions(+), 18 deletions(-) create mode 100644 messung/pruefstand/POSTERIOR.md create mode 100644 messung/pruefstand/bitgleich.py create mode 100644 messung/pruefstand/post-holdout.sha256 create mode 100644 messung/pruefstand/posterior-dev.json create mode 100644 messung/pruefstand/posterior-holdout.json create mode 100644 messung/pruefstand/posterior_bewerten.py create mode 100644 messung/pruefstand/posterior_spots.py create mode 100644 messung/pruefstand/tor/posterior-fluss/TOR.md create mode 100644 messung/pruefstand/tor/posterior-fluss/lbr-arm.txt create mode 100644 messung/pruefstand/tor/posterior-fluss/lbr-live.txt create mode 100644 messung/pruefstand/tor/posterior-fluss/tor.json create mode 100644 src/engine/vermerk.rs create mode 100644 werkzeuge/kippliste.py create mode 100644 werkzeuge/tor_echt.py diff --git a/.gitignore b/.gitignore index 0dc62079..43037574 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,9 @@ messung/leckfinder/*.teil/ messung/leckfinder/*.jsonl messung/leckfinder/*.log messung/grosse_calls/bin/ + +# Pruefstand (werkzeuge/kippliste.py, tor_echt.py): Kern-Kopien sind aus target/ reproduzierbar +messung/pruefstand/**/pokerbench-*.exe +messung/pruefstand/kipp/basis.jsonl +messung/pruefstand/kipp/kipp-*.json +messung/pruefstand/tor/*/kipp.json diff --git a/entscheiden/decide.py b/entscheiden/decide.py index 64e7ca56..996395c2 100644 --- a/entscheiden/decide.py +++ b/entscheiden/decide.py @@ -45,7 +45,7 @@ BEKANNTE_SCHALTER = ("MDF_UNREAD", "RAISE_DRAWS", "RAISE_PRIOR", "TURN_SPIEL", " "REST_STACK", "FORTSETZUNG", "POOL_PRIOR", "POSTERIOR", "GEGNER_LINIEN", "PREFLOP_VOLL", "PREFLOP_OHNE_ANTE", "PREFLOP_MIKRO", "PREFLOP_VOLL_TEILE", "WERT_BRETT", "FLUSS_WERT", "PAAR_RAISE", "BRETT_PAAR", "CALLED_JAM", "ALLIN_TIEFE", "UEBERBET", "CBET_LUFT", "POOL_STUFE", "GEGEN_GROSS", "BETTOR", "VETO_AB", "UEBERSCHUSS", "VORFLOP_BAND", "VORFLOP_POP", "DREIBET_TOPF", "CHECK_FALLE", "CHECK_FALLE_AGGR", "CHECK_FALLE_VERTRAUEN", "CHECK_FALLE_EQ", - "TISCHWAHL", "TISCHWAHL_AB", "SITZWAHL", "GEGNER_GEDAECHTNIS", "ZEIGT_KIPP", "STATION_ZUG", "RAISE_FOLD_DECKEL", "STEAL_BREITE", "INFO_KONSISTENT", "EINSATZ_BLUFF", "WETT_KURVE", "UEBERWERT") + "TISCHWAHL", "TISCHWAHL_AB", "SITZWAHL", "GEGNER_GEDAECHTNIS", "ZEIGT_KIPP", "STATION_ZUG", "RAISE_FOLD_DECKEL", "STEAL_BREITE", "INFO_KONSISTENT", "EINSATZ_BLUFF", "WETT_KURVE", "UEBERWERT", "ENTHALTUNG") # Schalter des LAEUFERS (betrieb/runner.py liest sie aus seiner eigenen Umgebung, nicht der Kern): aus der # Datei auch in os.environ, sonst schaltete ein Eintrag hier nichts. Eine ausdrueckliche Umgebung geht vor. # GEGNER_GEDAECHTNIS (die Uebergabe hier in `_gedaechtnis`) liest os.environ: ohne diesen Eintrag diff --git a/messung/pruefstand/POSTERIOR.md b/messung/pruefstand/POSTERIOR.md new file mode 100644 index 00000000..9c288a9c --- /dev/null +++ b/messung/pruefstand/POSTERIOR.md @@ -0,0 +1,77 @@ +# POSTERIOR auf echten NL2-Spots: Top-Paar+ gegen Flop-/Turn-Raise eines selten Erhöhenden + +Prüfstand 18.11. + +**Frage.** Ist es richtig, Top-Paar oder besser gegen einen Raise auf Flop oder Turn zu folden, wenn der Gegner selten erhöht? Das tut der Live-Stand mit `POSTERIOR=bluff,schutz,beleg` + `GEGNER_LINIEN` + `POOL_STUFE=rtb`. + +**Antwort: Nein, auf dem Flop klar falsch; auf dem Turn neutral.** Der Kandidat `POSTERIOR=bluff,schutz,beleg,fluss` wirkt nur am River. Er nimmt den Schaden vollständig heraus. + +## Daten und Methode + +Wie `messung/grosse_calls`: +- **Daten:** hhDealer CoinPoker NL2 6-max, 12,4 Mio. Hände (`nl2-6max-1jahr.zip`). +- **Spots:** Caller-Sicht (`spots2.jsonl` / `spots2.holdout.jsonl`, Spieler-Holdout), Muck-IPW-Gewicht `w`. +- **Filter:** Der Entscheider hat auf dieser Straße gesetzt und wurde erhöht (Linie `geraist`). Nur Flop und Turn, Handklasse Top-Paar oder besser. +- **Erzeugung:** `posterior_spots.py`, ausgewertet mit `posterior_bewerten.py`. +- **Gegner-Read:** Die Profile der Spots tragen keine Reads. Eingesetzt ist `reads.raiseToBet {n:1, k:0}`, also genau der Live-Zustand im Owner-Fall: ein Raise-Versuch gezählt, keiner erhöht. Das ist der Fall, gegen den S2 + `beleg` voll greifen. +- **Ergebnis:** 10 737 Spots dev (2 863 Setzer), 12 340 Spots holdout (3 358 Setzer). Holdout wurde einmal ausgewertet, nach der Wahl des Kandidaten auf dev. +- **Zwei Maße.** EV jeweils minus EV live in bb, Summe über die Spots, 95 %-Bootstrap über die Erhöher. + - `eq`: Equity gegen die gezeigte Hand × Topf nach Rake − Call. + - `real`: was die Population mit dem Weiterspielen wirklich gewann. + +## Fold-Anteile (gewichtet) + +| | vorne (Equity ≥ 0,5) | Fold live | Fold ohne POSTERIOR = `fluss` | +|---|---|---|---| +| Flop gesamt (dev / holdout) | 64 % / 64 % | 21 % / 27 % | 7 % / 7 % | +| Flop Top-Paar | 47 % / 48 % | 34 % / 43 % | 12 % / 11 % | +| Flop Overpair | 66 % / 65 % | 17 % / 20 % | 5 % / 5 % | +| Flop Zwei Paar | 77 % / 79 % | 18 % / 19 % | 3 % / 3 % | +| Flop Drilling | 87 % / 89 % | 5 % / 6 % | 2 % / 2 % | +| Turn gesamt | 59 % / 59 % | 27 % / 26 % | 27 % / 26 % | + +Auf dem Turn entscheidet POSTERIOR praktisch nichts. Die Turn-Folds kommen aus `TURN_RAISE_NUR`. + +## EV-Differenz gegen Live (bb, Summe, 95 %) + +| Arm | dev `eq` | dev `real` | holdout `eq` | holdout `real` | +|---|---|---|---|---| +| POSTERIOR aus | +37 261 [+30 789, +45 052] | +30 395 [+20 591, +40 874] | +53 276 [+45 250, +61 451] | +38 323 [+24 970, +51 085] | +| **`POSTERIOR=bluff,schutz,beleg,fluss`** | **+37 261 (identisch)** | **+30 395** | **+53 276** | **+38 323** | +| `GEGNER_LINIEN` aus | +15 170 | | +44 411 [+37 186, +52 074] | +29 470 [+18 710, +40 786] | +| `POOL_STUFE` aus | +20 486 | | +30 286 [+24 652, +36 805] | +18 716 [+9 357, +28 502] | +| `flussnur` (nur die Linientabelle auf den River) | +15 170 [+10 932, +19 725] | +14 204 | – | – | + +Nach Straße und Klasse: +- **Flop** dev `eq` +36 712, holdout +53 464. +- **Turn** dev +549 [+56, +1 191], holdout −188 [−497, +24]: neutral. +- **Flop Top-Paar** holdout `eq` +22 058 [+17 269, +26 971]. + - `real` +6 964 [−1 780, +16 449]: Top-Paar allein ist im echten Ausgang nicht signifikant. + - Overpair, Zwei Paar und Drilling sind es je einzeln. +- **Regulars als Erhöher** (n = 61 / 90): `eq` dev +2 031, holdout +2 003, beide signifikant. `real` schließt 0 ein. + +## Warum + +S2 (`glaube::bluff`) setzt den Bluff-Anteil eines Raises nach Linie und Read. Gegen „hebt selten“ drückt es ihn unter 0,05; im Owner-Fall war er 0,013, ohne POSTERIOR 0,400. Danach greift `bluff_catch_blocked`: Eine Hand unter der Wertgrenze (Overpair) darf nicht mehr bluff-fangen. Der Call fällt weg, obwohl die Equity weit über Break-even liegt. + +Auf dem Flop ist das falsch: +- Ein NL2-Flop-Raise kommt aus einer breiten Range: Werte, Draws, Top-Paar-Schutz-Raises. +- Die Bluff-Fang-Logik ist für den River gebaut. Dort ist eine Range ohne Bluffs wirklich nur Wert. +- Auf dem Flop hat Top-Paar+ gegen Draws und schwächere Paare Equity, auch ohne einen einzigen Bluff. + +## Kandidat + +`POSTERIOR=bluff,schutz,beleg,fluss`. Neues Token `fluss`: S2 nur am River, Flop und Turn behalten den eingehenden Bluff-Anteil. +- Aus (ohne `fluss`) bitgleich zum Live-Stand. +- Am River bleibt S2 wie live; dort hat es nemesis-3 und die River-Folds getragen. +- Owner-Hand 180165100008 (KsJs, J24, Flop-Raise): + - live FOLD „EV call +0,16 | POSTERIOR: Raise selten geblufft (Bluffanteil 0.013, ohne POSTERIOR 0.400) …“ + - Kandidat CALL. +- Tor: `tor/posterior-fluss/TOR.md`. + +## Grenzen + +- **Caller-Sicht.** Nur Hände, in denen der Erhöhte weiterspielte oder zeigte, korrigiert durch Muck-IPW. +- **`eq` ohne spätere Straßen.** Dass wir nach dem Call auf dem Turn noch folden können, fehlt. +- **Eingesetzter Read** (n = 1). Echte Reads mit vielen Raises schwächen S2 über `schutz` ab. +- Die Zahlen sind Summen über die Spots, nicht bb/100. diff --git a/messung/pruefstand/bitgleich.py b/messung/pruefstand/bitgleich.py new file mode 100644 index 00000000..562243e8 --- /dev/null +++ b/messung/pruefstand/bitgleich.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +"""Bitgleich bis auf den Text: zwei Kern-Binaries mit denselben Schaltern auf denselben Anfragen; verglichen werden alle +Antwortfelder außer `reason` (Aktion, Größe, Konfidenz, Equity, Kategorie, Reads, EVs). + + python3 messung/pruefstand/bitgleich.py ... [--schalter betrieb/kern_schalter.txt] + [--prozesse 4] [--max 20000] + +Eine Zeile der Anfragedatei ist entweder die Anfrage selbst, ein Spot mit `req` oder eine Schatten-Zeile mit `anfrage`. +Ausgang 1, wenn ein Feld außer `reason` abweicht. Druckt die Zahl der Anfragen, der geänderten Texte und Beispiele. +""" +import argparse +import json +import os +import sys + +_HIER = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.join(_HIER, "..", "..", "werkzeuge")) +import kippliste as kl # noqa: E402 + + +def anfragen(pfade, maximal): + out = [] + for p in pfade: + for z in open(p, encoding="utf-8"): + if not z.strip(): + continue + d = json.loads(z) + req = d.get("req") or d.get("anfrage") or d + if isinstance(req, dict) and "street" in req: + out.append({"req": req}) + if len(out) >= maximal: + return out + return out + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("alt") + ap.add_argument("neu") + ap.add_argument("dateien", nargs="+") + ap.add_argument("--schalter", default=os.path.join(_HIER, "..", "..", "betrieb", "kern_schalter.txt")) + ap.add_argument("--prozesse", type=int, default=4) + ap.add_argument("--max", type=int, default=20000) + a = ap.parse_args() + env = kl.lies_schalter(a.schalter) + env.pop("TISCHWAHL", None) + sp = anfragen(a.dateien, a.max) + x = kl.kern_lauf(a.alt, sp, env, a.prozesse) + y = kl.kern_lauf(a.neu, sp, env, a.prozesse) + abw, text = [], [] + for s, u, v in zip(sp, x, y): + uu = {k: w for k, w in u.items() if k != "reason"} + vv = {k: w for k, w in v.items() if k != "reason"} + if uu != vv: + abw.append((s, u, v)) + elif u.get("reason") != v.get("reason"): + text.append((u.get("reason"), v.get("reason"))) + print("%d Anfragen, %d Abweichungen ausser reason, %d neue Begruendungstexte" % (len(sp), len(abw), len(text))) + for _, u, v in abw[:5]: + print("ABWEICHUNG", json.dumps(u)[:300], "\n ->", json.dumps(v)[:300]) + for u, v in text[:12]: + print("TEXT", (v or "")[len(u or ""):][:260]) + return 1 if abw else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/messung/pruefstand/post-holdout.sha256 b/messung/pruefstand/post-holdout.sha256 new file mode 100644 index 00000000..dce715b9 --- /dev/null +++ b/messung/pruefstand/post-holdout.sha256 @@ -0,0 +1 @@ +764d1635f504d44c79101b530e41ef2076cd8a97e39fdb91da1922099de1a1b3 diff --git a/messung/pruefstand/posterior-dev.json b/messung/pruefstand/posterior-dev.json new file mode 100644 index 00000000..cc97e006 --- /dev/null +++ b/messung/pruefstand/posterior-dev.json @@ -0,0 +1,1443 @@ +{ + "arme": [ + "antw-dev-live", + "antw-dev-kand-live", + "antw-dev-post-aus", + "antw-dev-fluss", + "antw-dev-flussnur" + ], + "kipps": { + "antw-dev-post-aus: CALL->RAISE": 193, + "antw-dev-fluss: CALL->RAISE": 193, + "antw-dev-flussnur: CALL->RAISE": 134, + "antw-dev-post-aus: FOLD->CALL": 801, + "antw-dev-fluss: FOLD->CALL": 801, + "antw-dev-flussnur: FOLD->CALL": 369, + "antw-dev-post-aus: FOLD->RAISE": 38, + "antw-dev-fluss: FOLD->RAISE": 38, + "antw-dev-flussnur: FOLD->RAISE": 35, + "antw-dev-flussnur: CALL->FOLD": 3, + "antw-dev-post-aus: ABSTAIN->RAISE": 2, + "antw-dev-fluss: ABSTAIN->RAISE": 2, + "antw-dev-flussnur: ABSTAIN->RAISE": 1, + "antw-dev-post-aus: CALL->FOLD": 3, + "antw-dev-fluss: CALL->FOLD": 3, + "antw-dev-post-aus: RAISE->CALL": 5, + "antw-dev-fluss: RAISE->CALL": 5, + "antw-dev-flussnur: RAISE->CALL": 1 + }, + "fold": { + "alle": [ + 0.24, + 0.24, + 0.161, + 0.161, + 0.202 + ], + "besser_als_tp": [ + 0.147, + 0.147, + 0.103, + 0.103, + 0.129 + ], + "drilling": [ + 0.082, + 0.082, + 0.066, + 0.066, + 0.074 + ], + "flop": [ + 0.214, + 0.214, + 0.071, + 0.071, + 0.146 + ], + "flop_drilling": [ + 0.047, + 0.047, + 0.015, + 0.015, + 0.031 + ], + "flop_monster": [ + 0.014, + 0.014, + 0.007, + 0.007, + 0.007 + ], + "flop_overpair": [ + 0.166, + 0.166, + 0.046, + 0.046, + 0.112 + ], + "flop_top_paar": [ + 0.335, + 0.335, + 0.123, + 0.123, + 0.229 + ], + "flop_zwei_paar": [ + 0.175, + 0.175, + 0.034, + 0.034, + 0.13 + ], + "kein_reg_setzer": [ + 0.239, + 0.239, + 0.159, + 0.159, + 0.2 + ], + "monster": [ + 0.038, + 0.038, + 0.036, + 0.036, + 0.036 + ], + "overpair": [ + 0.215, + 0.215, + 0.13, + 0.13, + 0.177 + ], + "reg_setzer": [ + 0.259, + 0.259, + 0.191, + 0.191, + 0.246 + ], + "top_paar": [ + 0.39, + 0.39, + 0.254, + 0.254, + 0.322 + ], + "tp": [ + 0.39, + 0.39, + 0.254, + 0.254, + 0.322 + ], + "turn": [ + 0.272, + 0.272, + 0.27, + 0.27, + 0.27 + ], + "turn_drilling": [ + 0.119, + 0.119, + 0.118, + 0.118, + 0.118 + ], + "turn_monster": [ + 0.044, + 0.044, + 0.044, + 0.044, + 0.044 + ], + "turn_overpair": [ + 0.336, + 0.336, + 0.336, + 0.336, + 0.336 + ], + "turn_top_paar": [ + 0.485, + 0.485, + 0.48, + 0.48, + 0.482 + ], + "turn_zwei_paar": [ + 0.355, + 0.355, + 0.355, + 0.355, + 0.355 + ], + "typ_a": [ + 0.215, + 0.215, + 0.152, + 0.152, + 0.206 + ], + "typ_m": [ + 0.22, + 0.22, + 0.165, + 0.165, + 0.217 + ], + "typ_p": [ + 0.235, + 0.235, + 0.174, + 0.174, + 0.233 + ], + "typ_u": [ + 0.267, + 0.267, + 0.135, + 0.135, + 0.136 + ], + "zwei_paar": [ + 0.267, + 0.267, + 0.199, + 0.199, + 0.246 + ] + }, + "vorne": { + "alle": 0.614, + "besser_als_tp": 0.721, + "drilling": 0.776, + "flop": 0.637, + "flop_drilling": 0.871, + "flop_monster": 0.923, + "flop_overpair": 0.664, + "flop_top_paar": 0.469, + "flop_zwei_paar": 0.768, + "kein_reg_setzer": 0.617, + "monster": 0.85, + "overpair": 0.611, + "reg_setzer": 0.559, + "top_paar": 0.441, + "tp": 0.441, + "turn": 0.587, + "turn_drilling": 0.679, + "turn_monster": 0.83, + "turn_overpair": 0.479, + "turn_top_paar": 0.393, + "turn_zwei_paar": 0.559, + "typ_a": 0.641, + "typ_m": 0.659, + "typ_p": 0.573, + "typ_u": 0.643, + "zwei_paar": 0.661 + }, + "delta": { + "eq": { + "alle": { + "setzer": 2863, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 37260.7, + 30788.9, + 45051.9 + ], + "antw-dev-fluss": [ + 37260.7, + 30788.9, + 45051.9 + ], + "antw-dev-flussnur": [ + 15169.7, + 10931.8, + 19725.3 + ] + }, + "besser_als_tp": { + "setzer": 2208, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 24859.4, + 19490.1, + 30511.4 + ], + "antw-dev-fluss": [ + 24859.4, + 19490.1, + 30511.4 + ], + "antw-dev-flussnur": [ + 10483.5, + 7145.0, + 14322.3 + ] + }, + "drilling": { + "setzer": 965, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 4556.0, + 2474.7, + 7115.2 + ], + "antw-dev-fluss": [ + 4556.0, + 2474.7, + 7115.2 + ], + "antw-dev-flussnur": [ + 1885.5, + 601.2, + 3550.9 + ] + }, + "flop": { + "setzer": 2059, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 36711.5, + 30125.4, + 43738.7 + ], + "antw-dev-fluss": [ + 36711.5, + 30125.4, + 43738.7 + ], + "antw-dev-flussnur": [ + 14938.1, + 10543.2, + 19730.0 + ] + }, + "flop_drilling": { + "setzer": 576, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 4580.8, + 2529.5, + 6914.7 + ], + "antw-dev-fluss": [ + 4580.8, + 2529.5, + 6914.7 + ], + "antw-dev-flussnur": [ + 1910.4, + 668.9, + 3431.8 + ] + }, + "flop_monster": { + "setzer": 243, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 27.1, + -281.1, + 362.3 + ], + "antw-dev-fluss": [ + 27.1, + -281.1, + 362.3 + ], + "antw-dev-flussnur": [ + 27.1, + -281.1, + 362.3 + ] + }, + "flop_overpair": { + "setzer": 820, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 12241.4, + 8997.1, + 15816.6 + ], + "antw-dev-fluss": [ + 12241.4, + 8997.1, + 15816.6 + ], + "antw-dev-flussnur": [ + 6117.9, + 3620.9, + 9011.7 + ] + }, + "flop_top_paar": { + "setzer": 1294, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 11873.8, + 8291.4, + 15414.6 + ], + "antw-dev-fluss": [ + 11873.8, + 8291.4, + 15414.6 + ], + "antw-dev-flussnur": [ + 4429.8, + 2452.0, + 6548.4 + ] + }, + "flop_zwei_paar": { + "setzer": 412, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 7988.4, + 5341.9, + 11131.9 + ], + "antw-dev-fluss": [ + 7988.4, + 5341.9, + 11131.9 + ], + "antw-dev-flussnur": [ + 2453.0, + 881.9, + 4597.2 + ] + }, + "kein_reg_setzer": { + "setzer": 2802, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 35229.4, + 28660.5, + 42075.9 + ], + "antw-dev-fluss": [ + 35229.4, + 28660.5, + 42075.9 + ], + "antw-dev-flussnur": [ + 14694.2, + 10756.6, + 19168.1 + ] + }, + "monster": { + "setzer": 887, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 73.6, + -188.1, + 389.2 + ], + "antw-dev-fluss": [ + 73.6, + -188.1, + 389.2 + ], + "antw-dev-flussnur": [ + 27.1, + -281.1, + 362.3 + ] + }, + "overpair": { + "setzer": 1055, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 12241.4, + 9092.5, + 15972.9 + ], + "antw-dev-fluss": [ + 12241.4, + 9092.5, + 15972.9 + ], + "antw-dev-flussnur": [ + 6117.9, + 3732.8, + 8887.1 + ] + }, + "reg_setzer": { + "setzer": 61, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 2031.3, + 629.9, + 3824.0 + ], + "antw-dev-fluss": [ + 2031.3, + 629.9, + 3824.0 + ], + "antw-dev-flussnur": [ + 475.6, + -96.9, + 1967.6 + ] + }, + "top_paar": { + "setzer": 1719, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 12401.3, + 8807.8, + 16129.6 + ], + "antw-dev-fluss": [ + 12401.3, + 8807.8, + 16129.6 + ], + "antw-dev-flussnur": [ + 4686.3, + 2537.1, + 7045.7 + ] + }, + "tp": { + "setzer": 1719, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 12401.3, + 8667.7, + 16049.3 + ], + "antw-dev-fluss": [ + 12401.3, + 8667.7, + 16049.3 + ], + "antw-dev-flussnur": [ + 4686.3, + 2491.8, + 7084.8 + ] + }, + "turn": { + "setzer": 1930, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 549.2, + 55.9, + 1190.9 + ], + "antw-dev-fluss": [ + 549.2, + 55.9, + 1190.9 + ], + "antw-dev-flussnur": [ + 231.6, + -34.4, + 670.7 + ] + }, + "turn_drilling": { + "setzer": 609, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + -24.9, + -74.6, + 0.0 + ], + "antw-dev-fluss": [ + -24.9, + -74.6, + 0.0 + ], + "antw-dev-flussnur": [ + -24.9, + -74.6, + 0.0 + ] + }, + "turn_monster": { + "setzer": 770, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 46.5, + 0.0, + 186.0 + ], + "antw-dev-fluss": [ + 46.5, + 0.0, + 186.0 + ], + "antw-dev-flussnur": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_overpair": { + "setzer": 425, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-fluss": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-flussnur": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_top_paar": { + "setzer": 940, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 527.5, + 38.7, + 1222.4 + ], + "antw-dev-fluss": [ + 527.5, + 38.7, + 1222.4 + ], + "antw-dev-flussnur": [ + 256.5, + 5.8, + 706.1 + ] + }, + "turn_zwei_paar": { + "setzer": 445, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-fluss": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-flussnur": [ + 0.0, + 0.0, + 0.0 + ] + }, + "typ_a": { + "setzer": 79, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 774.4, + 200.9, + 1485.0 + ], + "antw-dev-fluss": [ + 774.4, + 200.9, + 1485.0 + ], + "antw-dev-flussnur": [ + 55.3, + -45.1, + 201.0 + ] + }, + "typ_m": { + "setzer": 625, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 10452.3, + 7268.7, + 14013.4 + ], + "antw-dev-fluss": [ + 10452.3, + 7268.7, + 14013.4 + ], + "antw-dev-flussnur": [ + 453.4, + -49.8, + 1241.9 + ] + }, + "typ_p": { + "setzer": 1005, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 11385.6, + 7870.9, + 15408.5 + ], + "antw-dev-fluss": [ + 11385.6, + 7870.9, + 15408.5 + ], + "antw-dev-flussnur": [ + 199.9, + -329.6, + 776.2 + ] + }, + "typ_u": { + "setzer": 1154, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 14648.3, + 10176.9, + 19152.8 + ], + "antw-dev-fluss": [ + 14648.3, + 10176.9, + 19152.8 + ], + "antw-dev-flussnur": [ + 14461.2, + 9923.8, + 18960.8 + ] + }, + "zwei_paar": { + "setzer": 730, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 7988.4, + 5397.6, + 11103.9 + ], + "antw-dev-fluss": [ + 7988.4, + 5397.6, + 11103.9 + ], + "antw-dev-flussnur": [ + 2453.0, + 869.4, + 4612.7 + ] + } + }, + "real": { + "alle": { + "setzer": 2863, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 30395.0, + 20591.2, + 40874.1 + ], + "antw-dev-fluss": [ + 30395.0, + 20591.2, + 40874.1 + ], + "antw-dev-flussnur": [ + 14204.4, + 7523.9, + 21571.6 + ] + }, + "besser_als_tp": { + "setzer": 2208, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 24263.0, + 16746.8, + 31791.9 + ], + "antw-dev-fluss": [ + 24263.0, + 16746.8, + 31791.9 + ], + "antw-dev-flussnur": [ + 10404.8, + 5688.8, + 15537.1 + ] + }, + "drilling": { + "setzer": 965, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 4921.0, + 2461.4, + 7531.8 + ], + "antw-dev-fluss": [ + 4921.0, + 2461.4, + 7531.8 + ], + "antw-dev-flussnur": [ + 1810.2, + 266.8, + 3632.3 + ] + }, + "flop": { + "setzer": 2059, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 30142.6, + 20017.6, + 40601.4 + ], + "antw-dev-fluss": [ + 30142.6, + 20017.6, + 40601.4 + ], + "antw-dev-flussnur": [ + 14401.5, + 7551.4, + 21170.5 + ] + }, + "flop_drilling": { + "setzer": 576, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 4994.7, + 2447.2, + 7866.1 + ], + "antw-dev-fluss": [ + 4994.7, + 2447.2, + 7866.1 + ], + "antw-dev-flussnur": [ + 1883.9, + 430.7, + 3823.7 + ] + }, + "flop_monster": { + "setzer": 243, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 117.9, + -198.9, + 652.1 + ], + "antw-dev-fluss": [ + 117.9, + -198.9, + 652.1 + ], + "antw-dev-flussnur": [ + 117.9, + -198.9, + 652.1 + ] + }, + "flop_overpair": { + "setzer": 820, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 11691.7, + 6186.2, + 16813.4 + ], + "antw-dev-fluss": [ + 11691.7, + 6186.2, + 16813.4 + ], + "antw-dev-flussnur": [ + 6790.1, + 3252.9, + 10976.0 + ] + }, + "flop_top_paar": { + "setzer": 1294, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 5843.4, + -1522.5, + 13185.3 + ], + "antw-dev-fluss": [ + 5843.4, + -1522.5, + 13185.3 + ], + "antw-dev-flussnur": [ + 3923.0, + -682.8, + 8444.6 + ] + }, + "flop_zwei_paar": { + "setzer": 412, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 7494.9, + 3479.6, + 12037.1 + ], + "antw-dev-fluss": [ + 7494.9, + 3479.6, + 12037.1 + ], + "antw-dev-flussnur": [ + 1686.6, + -665.8, + 4098.9 + ] + }, + "kein_reg_setzer": { + "setzer": 2802, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 28370.4, + 18384.2, + 39831.7 + ], + "antw-dev-fluss": [ + 28370.4, + 18384.2, + 39831.7 + ], + "antw-dev-flussnur": [ + 13547.1, + 7007.2, + 20663.4 + ] + }, + "monster": { + "setzer": 887, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 155.4, + -198.9, + 727.1 + ], + "antw-dev-fluss": [ + 155.4, + -198.9, + 727.1 + ], + "antw-dev-flussnur": [ + 117.9, + -198.9, + 652.1 + ] + }, + "overpair": { + "setzer": 1055, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 11691.7, + 6956.8, + 17183.6 + ], + "antw-dev-fluss": [ + 11691.7, + 6956.8, + 17183.6 + ], + "antw-dev-flussnur": [ + 6790.1, + 3514.8, + 10874.1 + ] + }, + "reg_setzer": { + "setzer": 61, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 2024.5, + -145.9, + 4336.7 + ], + "antw-dev-fluss": [ + 2024.5, + -145.9, + 4336.7 + ], + "antw-dev-flussnur": [ + 657.3, + 0.0, + 1898.5 + ] + }, + "top_paar": { + "setzer": 1719, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 6131.9, + -1035.5, + 13750.0 + ], + "antw-dev-fluss": [ + 6131.9, + -1035.5, + 13750.0 + ], + "antw-dev-flussnur": [ + 3799.5, + -906.8, + 8678.0 + ] + }, + "tp": { + "setzer": 1719, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 6131.9, + -1118.3, + 14241.4 + ], + "antw-dev-fluss": [ + 6131.9, + -1118.3, + 14241.4 + ], + "antw-dev-flussnur": [ + 3799.5, + -1038.5, + 8524.7 + ] + }, + "turn": { + "setzer": 1930, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 252.4, + -511.7, + 1042.5 + ], + "antw-dev-fluss": [ + 252.4, + -511.7, + 1042.5 + ], + "antw-dev-flussnur": [ + -197.1, + -793.9, + 276.6 + ] + }, + "turn_drilling": { + "setzer": 609, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + -73.7, + -221.0, + 0.0 + ], + "antw-dev-fluss": [ + -73.7, + -221.0, + 0.0 + ], + "antw-dev-flussnur": [ + -73.7, + -221.0, + 0.0 + ] + }, + "turn_monster": { + "setzer": 770, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 37.5, + 0.0, + 112.5 + ], + "antw-dev-fluss": [ + 37.5, + 0.0, + 112.5 + ], + "antw-dev-flussnur": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_overpair": { + "setzer": 425, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-fluss": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-flussnur": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_top_paar": { + "setzer": 940, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 288.5, + -471.2, + 1006.3 + ], + "antw-dev-fluss": [ + 288.5, + -471.2, + 1006.3 + ], + "antw-dev-flussnur": [ + -123.4, + -714.1, + 340.8 + ] + }, + "turn_zwei_paar": { + "setzer": 445, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-fluss": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-flussnur": [ + 0.0, + 0.0, + 0.0 + ] + }, + "typ_a": { + "setzer": 79, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 67.0, + -1225.9, + 1232.0 + ], + "antw-dev-fluss": [ + 67.0, + -1225.9, + 1232.0 + ], + "antw-dev-flussnur": [ + 182.6, + -110.5, + 589.5 + ] + }, + "typ_m": { + "setzer": 625, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 7860.3, + 3605.0, + 12231.6 + ], + "antw-dev-fluss": [ + 7860.3, + 3605.0, + 12231.6 + ], + "antw-dev-flussnur": [ + -411.9, + -1266.4, + 368.4 + ] + }, + "typ_p": { + "setzer": 1005, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 8421.3, + 2703.3, + 14867.5 + ], + "antw-dev-fluss": [ + 8421.3, + 2703.3, + 14867.5 + ], + "antw-dev-flussnur": [ + 95.4, + -631.6, + 946.2 + ] + }, + "typ_u": { + "setzer": 1154, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 14046.3, + 7254.0, + 21422.6 + ], + "antw-dev-fluss": [ + 14046.3, + 7254.0, + 21422.6 + ], + "antw-dev-flussnur": [ + 14338.2, + 7503.3, + 21644.8 + ] + }, + "zwei_paar": { + "setzer": 730, + "antw-dev-kand-live": [ + 0.0, + 0.0, + 0.0 + ], + "antw-dev-post-aus": [ + 7494.9, + 3596.3, + 11813.6 + ], + "antw-dev-fluss": [ + 7494.9, + 3596.3, + 11813.6 + ], + "antw-dev-flussnur": [ + 1686.6, + -648.5, + 4308.8 + ] + } + } + } +} \ No newline at end of file diff --git a/messung/pruefstand/posterior-holdout.json b/messung/pruefstand/posterior-holdout.json new file mode 100644 index 00000000..3e0f9f64 --- /dev/null +++ b/messung/pruefstand/posterior-holdout.json @@ -0,0 +1,1461 @@ +{ + "arme": [ + "antw-holdout-live", + "antw-holdout-post-aus", + "antw-holdout-fluss", + "antw-holdout-linien-aus", + "antw-holdout-pool-aus" + ], + "kipps": { + "antw-holdout-post-aus: FOLD->CALL": 1295, + "antw-holdout-fluss: FOLD->CALL": 1295, + "antw-holdout-linien-aus: FOLD->CALL": 1083, + "antw-holdout-pool-aus: FOLD->CALL": 880, + "antw-holdout-post-aus: CALL->RAISE": 424, + "antw-holdout-fluss: CALL->RAISE": 424, + "antw-holdout-linien-aus: CALL->RAISE": 398, + "antw-holdout-pool-aus: CALL->RAISE": 191, + "antw-holdout-post-aus: FOLD->RAISE": 68, + "antw-holdout-fluss: FOLD->RAISE": 68, + "antw-holdout-linien-aus: FOLD->RAISE": 67, + "antw-holdout-post-aus: ABSTAIN->CALL": 1, + "antw-holdout-fluss: ABSTAIN->CALL": 1, + "antw-holdout-linien-aus: ABSTAIN->CALL": 1, + "antw-holdout-pool-aus: CALL->FOLD": 14, + "antw-holdout-post-aus: CALL->FOLD": 7, + "antw-holdout-fluss: CALL->FOLD": 7, + "antw-holdout-post-aus: FOLD->ABSTAIN": 1, + "antw-holdout-fluss: FOLD->ABSTAIN": 1, + "antw-holdout-linien-aus: FOLD->ABSTAIN": 1, + "antw-holdout-pool-aus: FOLD->RAISE": 20, + "antw-holdout-post-aus: RAISE->CALL": 10, + "antw-holdout-fluss: RAISE->CALL": 10, + "antw-holdout-linien-aus: RAISE->CALL": 7, + "antw-holdout-pool-aus: RAISE->FOLD": 1, + "antw-holdout-post-aus: ABSTAIN->RAISE": 1, + "antw-holdout-fluss: ABSTAIN->RAISE": 1, + "antw-holdout-linien-aus: ABSTAIN->RAISE": 1, + "antw-holdout-pool-aus: ABSTAIN->CALL": 1, + "antw-holdout-linien-aus: CALL->FOLD": 3, + "antw-holdout-pool-aus: RAISE->CALL": 8, + "antw-holdout-post-aus: CALL->ABSTAIN": 1, + "antw-holdout-fluss: CALL->ABSTAIN": 1, + "antw-holdout-linien-aus: CALL->ABSTAIN": 1, + "antw-holdout-pool-aus: CALL->ABSTAIN": 1, + "antw-holdout-pool-aus: ABSTAIN->RAISE": 1 + }, + "fold": { + "alle": [ + 0.267, + 0.154, + 0.154, + 0.172, + 0.194 + ], + "besser_als_tp": [ + 0.158, + 0.102, + 0.102, + 0.112, + 0.123 + ], + "drilling": [ + 0.085, + 0.062, + 0.062, + 0.066, + 0.073 + ], + "flop": [ + 0.27, + 0.066, + 0.066, + 0.098, + 0.138 + ], + "flop_drilling": [ + 0.06, + 0.015, + 0.015, + 0.022, + 0.037 + ], + "flop_monster": [ + 0.017, + 0.003, + 0.003, + 0.003, + 0.01 + ], + "flop_overpair": [ + 0.203, + 0.052, + 0.052, + 0.077, + 0.103 + ], + "flop_top_paar": [ + 0.429, + 0.108, + 0.108, + 0.155, + 0.216 + ], + "flop_zwei_paar": [ + 0.194, + 0.027, + 0.027, + 0.065, + 0.1 + ], + "kein_reg_setzer": [ + 0.264, + 0.152, + 0.152, + 0.169, + 0.191 + ], + "monster": [ + 0.048, + 0.045, + 0.045, + 0.045, + 0.046 + ], + "overpair": [ + 0.24, + 0.128, + 0.128, + 0.146, + 0.166 + ], + "reg_setzer": [ + 0.301, + 0.19, + 0.19, + 0.214, + 0.231 + ], + "top_paar": [ + 0.439, + 0.238, + 0.238, + 0.267, + 0.306 + ], + "tp": [ + 0.439, + 0.238, + 0.238, + 0.267, + 0.306 + ], + "turn": [ + 0.263, + 0.261, + 0.261, + 0.261, + 0.262 + ], + "turn_drilling": [ + 0.108, + 0.107, + 0.107, + 0.107, + 0.108 + ], + "turn_monster": [ + 0.057, + 0.057, + 0.057, + 0.057, + 0.057 + ], + "turn_overpair": [ + 0.34, + 0.338, + 0.338, + 0.338, + 0.34 + ], + "turn_top_paar": [ + 0.456, + 0.455, + 0.455, + 0.455, + 0.456 + ], + "turn_zwei_paar": [ + 0.325, + 0.319, + 0.319, + 0.321, + 0.319 + ], + "typ_a": [ + 0.244, + 0.194, + 0.194, + 0.244, + 0.219 + ], + "typ_m": [ + 0.228, + 0.176, + 0.176, + 0.226, + 0.2 + ], + "typ_p": [ + 0.229, + 0.16, + 0.16, + 0.226, + 0.191 + ], + "typ_u": [ + 0.282, + 0.149, + 0.149, + 0.149, + 0.193 + ], + "zwei_paar": [ + 0.263, + 0.182, + 0.182, + 0.2, + 0.216 + ] + }, + "vorne": { + "alle": 0.616, + "besser_als_tp": 0.724, + "drilling": 0.791, + "flop": 0.641, + "flop_drilling": 0.887, + "flop_monster": 0.923, + "flop_overpair": 0.647, + "flop_top_paar": 0.483, + "flop_zwei_paar": 0.79, + "kein_reg_setzer": 0.623, + "monster": 0.831, + "overpair": 0.612, + "reg_setzer": 0.529, + "top_paar": 0.445, + "tp": 0.445, + "turn": 0.586, + "turn_drilling": 0.7, + "turn_monster": 0.805, + "turn_overpair": 0.515, + "turn_top_paar": 0.381, + "turn_zwei_paar": 0.576, + "typ_a": 0.689, + "typ_m": 0.642, + "typ_p": 0.565, + "typ_u": 0.626, + "zwei_paar": 0.677 + }, + "delta": { + "eq": { + "alle": { + "setzer": 3358, + "antw-holdout-post-aus": [ + 53275.7, + 45250.5, + 61450.8 + ], + "antw-holdout-fluss": [ + 53275.7, + 45250.5, + 61450.8 + ], + "antw-holdout-linien-aus": [ + 44411.2, + 37185.9, + 52073.6 + ], + "antw-holdout-pool-aus": [ + 30285.7, + 24651.9, + 36805.4 + ] + }, + "besser_als_tp": { + "setzer": 2556, + "antw-holdout-post-aus": [ + 31214.9, + 25546.4, + 37081.5 + ], + "antw-holdout-fluss": [ + 31214.9, + 25546.4, + 37081.5 + ], + "antw-holdout-linien-aus": [ + 25876.8, + 20793.0, + 31166.6 + ], + "antw-holdout-pool-aus": [ + 19253.0, + 14302.0, + 24204.7 + ] + }, + "drilling": { + "setzer": 1082, + "antw-holdout-post-aus": [ + 5427.0, + 3020.7, + 8062.4 + ], + "antw-holdout-fluss": [ + 5427.0, + 3020.7, + 8062.4 + ], + "antw-holdout-linien-aus": [ + 4731.2, + 2326.1, + 7243.2 + ], + "antw-holdout-pool-aus": [ + 2721.8, + 196.0, + 5485.8 + ] + }, + "flop": { + "setzer": 2397, + "antw-holdout-post-aus": [ + 53463.9, + 45629.0, + 61071.7 + ], + "antw-holdout-fluss": [ + 53463.9, + 45629.0, + 61071.7 + ], + "antw-holdout-linien-aus": [ + 44577.9, + 37070.5, + 52448.1 + ], + "antw-holdout-pool-aus": [ + 30470.7, + 24670.1, + 36408.8 + ] + }, + "flop_drilling": { + "setzer": 625, + "antw-holdout-post-aus": [ + 5415.3, + 3120.1, + 8237.0 + ], + "antw-holdout-fluss": [ + 5415.3, + 3120.1, + 8237.0 + ], + "antw-holdout-linien-aus": [ + 4719.4, + 2527.7, + 7353.4 + ], + "antw-holdout-pool-aus": [ + 2721.8, + 225.5, + 5378.4 + ] + }, + "flop_monster": { + "setzer": 305, + "antw-holdout-post-aus": [ + 234.3, + -78.8, + 758.6 + ], + "antw-holdout-fluss": [ + 234.3, + -78.8, + 758.6 + ], + "antw-holdout-linien-aus": [ + 234.3, + -78.8, + 758.6 + ], + "antw-holdout-pool-aus": [ + 247.3, + 0.0, + 713.1 + ] + }, + "flop_overpair": { + "setzer": 957, + "antw-holdout-post-aus": [ + 16224.7, + 12786.2, + 20474.6 + ], + "antw-holdout-fluss": [ + 16224.7, + 12786.2, + 20474.6 + ], + "antw-holdout-linien-aus": [ + 13051.7, + 10003.5, + 16616.0 + ], + "antw-holdout-pool-aus": [ + 10871.6, + 7930.0, + 14193.7 + ] + }, + "flop_top_paar": { + "setzer": 1457, + "antw-holdout-post-aus": [ + 22057.8, + 17269.1, + 26971.2 + ], + "antw-holdout-fluss": [ + 22057.8, + 17269.1, + 26971.2 + ], + "antw-holdout-linien-aus": [ + 18531.3, + 14217.8, + 22954.6 + ], + "antw-holdout-pool-aus": [ + 11065.9, + 7704.4, + 14582.1 + ] + }, + "flop_zwei_paar": { + "setzer": 472, + "antw-holdout-post-aus": [ + 9532.0, + 6640.4, + 12616.1 + ], + "antw-holdout-fluss": [ + 9532.0, + 6640.4, + 12616.1 + ], + "antw-holdout-linien-aus": [ + 8041.2, + 5436.2, + 10908.3 + ], + "antw-holdout-pool-aus": [ + 5564.1, + 3763.2, + 7584.6 + ] + }, + "kein_reg_setzer": { + "setzer": 3268, + "antw-holdout-post-aus": [ + 51273.1, + 43622.5, + 59576.2 + ], + "antw-holdout-fluss": [ + 51273.1, + 43622.5, + 59576.2 + ], + "antw-holdout-linien-aus": [ + 42696.9, + 35175.7, + 50539.1 + ], + "antw-holdout-pool-aus": [ + 29520.3, + 23404.2, + 35473.7 + ] + }, + "monster": { + "setzer": 1001, + "antw-holdout-post-aus": [ + 234.3, + -90.7, + 810.1 + ], + "antw-holdout-fluss": [ + 234.3, + -90.7, + 810.1 + ], + "antw-holdout-linien-aus": [ + 234.3, + -90.7, + 810.1 + ], + "antw-holdout-pool-aus": [ + 247.3, + 0.0, + 720.8 + ] + }, + "overpair": { + "setzer": 1189, + "antw-holdout-post-aus": [ + 16173.4, + 12377.5, + 20386.4 + ], + "antw-holdout-fluss": [ + 16173.4, + 12377.5, + 20386.4 + ], + "antw-holdout-linien-aus": [ + 13000.4, + 9773.0, + 16536.0 + ], + "antw-holdout-pool-aus": [ + 10871.6, + 7734.1, + 14505.2 + ] + }, + "reg_setzer": { + "setzer": 90, + "antw-holdout-post-aus": [ + 2002.6, + 381.2, + 3934.7 + ], + "antw-holdout-fluss": [ + 2002.6, + 381.2, + 3934.7 + ], + "antw-holdout-linien-aus": [ + 1714.3, + 165.8, + 3601.6 + ], + "antw-holdout-pool-aus": [ + 765.5, + -213.2, + 1784.6 + ] + }, + "top_paar": { + "setzer": 1983, + "antw-holdout-post-aus": [ + 22060.8, + 17731.4, + 27063.9 + ], + "antw-holdout-fluss": [ + 22060.8, + 17731.4, + 27063.9 + ], + "antw-holdout-linien-aus": [ + 18534.4, + 14334.4, + 23435.6 + ], + "antw-holdout-pool-aus": [ + 11032.7, + 7586.8, + 14653.9 + ] + }, + "tp": { + "setzer": 1983, + "antw-holdout-post-aus": [ + 22060.8, + 16968.9, + 26656.2 + ], + "antw-holdout-fluss": [ + 22060.8, + 16968.9, + 26656.2 + ], + "antw-holdout-linien-aus": [ + 18534.4, + 13748.4, + 22909.7 + ], + "antw-holdout-pool-aus": [ + 11032.7, + 7529.2, + 14427.5 + ] + }, + "turn": { + "setzer": 2181, + "antw-holdout-post-aus": [ + -188.2, + -496.6, + 24.1 + ], + "antw-holdout-fluss": [ + -188.2, + -496.6, + 24.1 + ], + "antw-holdout-linien-aus": [ + -166.7, + -462.8, + 37.9 + ], + "antw-holdout-pool-aus": [ + -184.9, + -463.2, + -21.5 + ] + }, + "turn_drilling": { + "setzer": 689, + "antw-holdout-post-aus": [ + 11.8, + 0.0, + 35.3 + ], + "antw-holdout-fluss": [ + 11.8, + 0.0, + 35.3 + ], + "antw-holdout-linien-aus": [ + 11.8, + 0.0, + 35.3 + ], + "antw-holdout-pool-aus": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_monster": { + "setzer": 845, + "antw-holdout-post-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-holdout-fluss": [ + 0.0, + 0.0, + 0.0 + ], + "antw-holdout-linien-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-holdout-pool-aus": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_overpair": { + "setzer": 433, + "antw-holdout-post-aus": [ + -51.3, + -153.9, + 0.0 + ], + "antw-holdout-fluss": [ + -51.3, + -153.9, + 0.0 + ], + "antw-holdout-linien-aus": [ + -51.3, + -153.9, + 0.0 + ], + "antw-holdout-pool-aus": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_top_paar": { + "setzer": 1052, + "antw-holdout-post-aus": [ + 3.1, + -99.5, + 108.7 + ], + "antw-holdout-fluss": [ + 3.1, + -99.5, + 108.7 + ], + "antw-holdout-linien-aus": [ + 3.1, + -99.5, + 108.7 + ], + "antw-holdout-pool-aus": [ + -33.2, + -99.5, + 0.0 + ] + }, + "turn_zwei_paar": { + "setzer": 570, + "antw-holdout-post-aus": [ + -151.8, + -399.2, + -8.4 + ], + "antw-holdout-fluss": [ + -151.8, + -399.2, + -8.4 + ], + "antw-holdout-linien-aus": [ + -130.3, + -356.2, + 0.0 + ], + "antw-holdout-pool-aus": [ + -151.8, + -399.2, + -8.4 + ] + }, + "typ_a": { + "setzer": 62, + "antw-holdout-post-aus": [ + 179.2, + -71.3, + 551.6 + ], + "antw-holdout-fluss": [ + 179.2, + -71.3, + 551.6 + ], + "antw-holdout-linien-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-holdout-pool-aus": [ + 14.9, + -111.9, + 171.4 + ] + }, + "typ_m": { + "setzer": 421, + "antw-holdout-post-aus": [ + 2429.8, + 1221.5, + 3747.7 + ], + "antw-holdout-fluss": [ + 2429.8, + 1221.5, + 3747.7 + ], + "antw-holdout-linien-aus": [ + 297.8, + -24.8, + 830.0 + ], + "antw-holdout-pool-aus": [ + 1181.8, + 441.4, + 2020.8 + ] + }, + "typ_p": { + "setzer": 679, + "antw-holdout-post-aus": [ + 6775.4, + 3984.9, + 9976.0 + ], + "antw-holdout-fluss": [ + 6775.4, + 3984.9, + 9976.0 + ], + "antw-holdout-linien-aus": [ + 316.5, + 42.2, + 743.9 + ], + "antw-holdout-pool-aus": [ + 3615.2, + 1502.2, + 6261.4 + ] + }, + "typ_u": { + "setzer": 2196, + "antw-holdout-post-aus": [ + 43891.3, + 36053.5, + 50845.7 + ], + "antw-holdout-fluss": [ + 43891.3, + 36053.5, + 50845.7 + ], + "antw-holdout-linien-aus": [ + 43796.9, + 35982.4, + 50687.6 + ], + "antw-holdout-pool-aus": [ + 25473.8, + 19820.8, + 30831.8 + ] + }, + "zwei_paar": { + "setzer": 898, + "antw-holdout-post-aus": [ + 9380.2, + 6376.0, + 12454.4 + ], + "antw-holdout-fluss": [ + 9380.2, + 6376.0, + 12454.4 + ], + "antw-holdout-linien-aus": [ + 7910.9, + 5068.5, + 11034.2 + ], + "antw-holdout-pool-aus": [ + 5412.3, + 3565.1, + 7487.2 + ] + } + }, + "real": { + "alle": { + "setzer": 3358, + "antw-holdout-post-aus": [ + 38322.9, + 24970.0, + 51085.4 + ], + "antw-holdout-fluss": [ + 38322.9, + 24970.0, + 51085.4 + ], + "antw-holdout-linien-aus": [ + 29470.2, + 18710.0, + 40786.4 + ], + "antw-holdout-pool-aus": [ + 18716.3, + 9357.0, + 28501.6 + ] + }, + "besser_als_tp": { + "setzer": 2556, + "antw-holdout-post-aus": [ + 31356.2, + 22647.0, + 40096.4 + ], + "antw-holdout-fluss": [ + 31356.2, + 22647.0, + 40096.4 + ], + "antw-holdout-linien-aus": [ + 24764.4, + 17333.4, + 32858.6 + ], + "antw-holdout-pool-aus": [ + 17619.7, + 10839.9, + 24755.0 + ] + }, + "drilling": { + "setzer": 1082, + "antw-holdout-post-aus": [ + 5555.1, + 2709.8, + 8603.2 + ], + "antw-holdout-fluss": [ + 5555.1, + 2709.8, + 8603.2 + ], + "antw-holdout-linien-aus": [ + 4995.2, + 2349.2, + 8066.0 + ], + "antw-holdout-pool-aus": [ + 2424.4, + -517.0, + 5253.6 + ] + }, + "flop": { + "setzer": 2397, + "antw-holdout-post-aus": [ + 38274.7, + 26135.0, + 50320.3 + ], + "antw-holdout-fluss": [ + 38274.7, + 26135.0, + 50320.3 + ], + "antw-holdout-linien-aus": [ + 29388.0, + 17928.7, + 41258.9 + ], + "antw-holdout-pool-aus": [ + 18954.8, + 9539.3, + 29024.3 + ] + }, + "flop_drilling": { + "setzer": 625, + "antw-holdout-post-aus": [ + 5566.1, + 2852.2, + 8932.2 + ], + "antw-holdout-fluss": [ + 5566.1, + 2852.2, + 8932.2 + ], + "antw-holdout-linien-aus": [ + 5006.3, + 2454.0, + 8320.5 + ], + "antw-holdout-pool-aus": [ + 2424.4, + -271.4, + 5430.6 + ] + }, + "flop_monster": { + "setzer": 305, + "antw-holdout-post-aus": [ + 194.7, + -375.4, + 916.0 + ], + "antw-holdout-fluss": [ + 194.7, + -375.4, + 916.0 + ], + "antw-holdout-linien-aus": [ + 194.7, + -375.4, + 916.0 + ], + "antw-holdout-pool-aus": [ + 397.9, + 0.0, + 1053.2 + ] + }, + "flop_overpair": { + "setzer": 957, + "antw-holdout-post-aus": [ + 15877.8, + 9720.2, + 22050.0 + ], + "antw-holdout-fluss": [ + 15877.8, + 9720.2, + 22050.0 + ], + "antw-holdout-linien-aus": [ + 12729.9, + 7173.3, + 18316.5 + ], + "antw-holdout-pool-aus": [ + 8319.2, + 3682.7, + 13677.4 + ] + }, + "flop_top_paar": { + "setzer": 1457, + "antw-holdout-post-aus": [ + 6963.7, + -1779.6, + 16449.0 + ], + "antw-holdout-fluss": [ + 6963.7, + -1779.6, + 16449.0 + ], + "antw-holdout-linien-aus": [ + 4702.7, + -3567.2, + 13157.9 + ], + "antw-holdout-pool-aus": [ + 1129.8, + -6070.4, + 8827.0 + ] + }, + "flop_zwei_paar": { + "setzer": 472, + "antw-holdout-post-aus": [ + 9672.4, + 5369.7, + 14048.3 + ], + "antw-holdout-fluss": [ + 9672.4, + 5369.7, + 14048.3 + ], + "antw-holdout-linien-aus": [ + 6754.4, + 3046.1, + 10548.4 + ], + "antw-holdout-pool-aus": [ + 6683.6, + 3383.5, + 9807.9 + ] + }, + "kein_reg_setzer": { + "setzer": 3268, + "antw-holdout-post-aus": [ + 38177.4, + 26878.5, + 50278.5 + ], + "antw-holdout-fluss": [ + 38177.4, + 26878.5, + 50278.5 + ], + "antw-holdout-linien-aus": [ + 30123.9, + 19728.5, + 41477.8 + ], + "antw-holdout-pool-aus": [ + 19566.7, + 10234.3, + 29371.8 + ] + }, + "monster": { + "setzer": 1001, + "antw-holdout-post-aus": [ + 194.7, + -399.7, + 837.2 + ], + "antw-holdout-fluss": [ + 194.7, + -399.7, + 837.2 + ], + "antw-holdout-linien-aus": [ + 194.7, + -399.7, + 837.2 + ], + "antw-holdout-pool-aus": [ + 397.9, + 0.0, + 949.3 + ] + }, + "overpair": { + "setzer": 1189, + "antw-holdout-post-aus": [ + 16139.3, + 10250.3, + 22590.6 + ], + "antw-holdout-fluss": [ + 16139.3, + 10250.3, + 22590.6 + ], + "antw-holdout-linien-aus": [ + 12991.4, + 7930.8, + 18292.9 + ], + "antw-holdout-pool-aus": [ + 8319.2, + 3697.5, + 13657.2 + ] + }, + "reg_setzer": { + "setzer": 90, + "antw-holdout-post-aus": [ + 145.5, + -2862.6, + 3004.0 + ], + "antw-holdout-fluss": [ + 145.5, + -2862.6, + 3004.0 + ], + "antw-holdout-linien-aus": [ + -653.7, + -3450.3, + 1882.5 + ], + "antw-holdout-pool-aus": [ + -850.4, + -3014.9, + 1059.2 + ] + }, + "top_paar": { + "setzer": 1983, + "antw-holdout-post-aus": [ + 6966.7, + -2636.6, + 16739.2 + ], + "antw-holdout-fluss": [ + 6966.7, + -2636.6, + 16739.2 + ], + "antw-holdout-linien-aus": [ + 4705.8, + -3905.9, + 13770.3 + ], + "antw-holdout-pool-aus": [ + 1096.6, + -6311.1, + 9592.4 + ] + }, + "tp": { + "setzer": 1983, + "antw-holdout-post-aus": [ + 6966.7, + -1897.2, + 16669.4 + ], + "antw-holdout-fluss": [ + 6966.7, + -1897.2, + 16669.4 + ], + "antw-holdout-linien-aus": [ + 4705.8, + -3553.3, + 13347.6 + ], + "antw-holdout-pool-aus": [ + 1096.6, + -6083.4, + 8563.2 + ] + }, + "turn": { + "setzer": 2181, + "antw-holdout-post-aus": [ + 48.2, + -408.9, + 733.4 + ], + "antw-holdout-fluss": [ + 48.2, + -408.9, + 733.4 + ], + "antw-holdout-linien-aus": [ + 82.3, + -379.4, + 753.9 + ], + "antw-holdout-pool-aus": [ + -238.5, + -512.9, + -34.1 + ] + }, + "turn_drilling": { + "setzer": 689, + "antw-holdout-post-aus": [ + -11.1, + -33.2, + 0.0 + ], + "antw-holdout-fluss": [ + -11.1, + -33.2, + 0.0 + ], + "antw-holdout-linien-aus": [ + -11.1, + -33.2, + 0.0 + ], + "antw-holdout-pool-aus": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_monster": { + "setzer": 845, + "antw-holdout-post-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-holdout-fluss": [ + 0.0, + 0.0, + 0.0 + ], + "antw-holdout-linien-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-holdout-pool-aus": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_overpair": { + "setzer": 433, + "antw-holdout-post-aus": [ + 261.5, + 0.0, + 784.6 + ], + "antw-holdout-fluss": [ + 261.5, + 0.0, + 784.6 + ], + "antw-holdout-linien-aus": [ + 261.5, + 0.0, + 784.6 + ], + "antw-holdout-pool-aus": [ + 0.0, + 0.0, + 0.0 + ] + }, + "turn_top_paar": { + "setzer": 1052, + "antw-holdout-post-aus": [ + 3.1, + -99.5, + 108.7 + ], + "antw-holdout-fluss": [ + 3.1, + -99.5, + 108.7 + ], + "antw-holdout-linien-aus": [ + 3.1, + -99.5, + 108.7 + ], + "antw-holdout-pool-aus": [ + -33.2, + -99.5, + 0.0 + ] + }, + "turn_zwei_paar": { + "setzer": 570, + "antw-holdout-post-aus": [ + -205.3, + -515.8, + -17.5 + ], + "antw-holdout-fluss": [ + -205.3, + -515.8, + -17.5 + ], + "antw-holdout-linien-aus": [ + -171.3, + -478.8, + 0.0 + ], + "antw-holdout-pool-aus": [ + -205.3, + -515.8, + -17.5 + ] + }, + "typ_a": { + "setzer": 62, + "antw-holdout-post-aus": [ + 585.4, + -607.8, + 2193.5 + ], + "antw-holdout-fluss": [ + 585.4, + -607.8, + 2193.5 + ], + "antw-holdout-linien-aus": [ + 0.0, + 0.0, + 0.0 + ], + "antw-holdout-pool-aus": [ + 775.1, + 0.0, + 2088.1 + ] + }, + "typ_m": { + "setzer": 421, + "antw-holdout-post-aus": [ + 1315.0, + -1165.1, + 3632.7 + ], + "antw-holdout-fluss": [ + 1315.0, + -1165.1, + 3632.7 + ], + "antw-holdout-linien-aus": [ + 334.8, + -38.7, + 947.0 + ], + "antw-holdout-pool-aus": [ + 343.1, + -1496.5, + 2048.8 + ] + }, + "typ_p": { + "setzer": 679, + "antw-holdout-post-aus": [ + 7212.5, + 2609.3, + 11921.6 + ], + "antw-holdout-fluss": [ + 7212.5, + 2609.3, + 11921.6 + ], + "antw-holdout-linien-aus": [ + 92.9, + -451.7, + 712.3 + ], + "antw-holdout-pool-aus": [ + 2721.2, + -401.3, + 6123.9 + ] + }, + "typ_u": { + "setzer": 2196, + "antw-holdout-post-aus": [ + 29210.1, + 17265.5, + 40040.9 + ], + "antw-holdout-fluss": [ + 29210.1, + 17265.5, + 40040.9 + ], + "antw-holdout-linien-aus": [ + 29042.5, + 17102.1, + 39706.8 + ], + "antw-holdout-pool-aus": [ + 14876.9, + 5939.4, + 24197.3 + ] + }, + "zwei_paar": { + "setzer": 898, + "antw-holdout-post-aus": [ + 9467.1, + 5194.8, + 14293.2 + ], + "antw-holdout-fluss": [ + 9467.1, + 5194.8, + 14293.2 + ], + "antw-holdout-linien-aus": [ + 6583.1, + 2841.3, + 10981.3 + ], + "antw-holdout-pool-aus": [ + 6478.3, + 3617.2, + 9697.3 + ] + } + } + } +} \ No newline at end of file diff --git a/messung/pruefstand/posterior_bewerten.py b/messung/pruefstand/posterior_bewerten.py new file mode 100644 index 00000000..3fd4c742 --- /dev/null +++ b/messung/pruefstand/posterior_bewerten.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 +"""POSTERIOR auf echten Spots, Schritt 2: EV je Arm gegen den Live-Stand auf den Spots aus `posterior_spots.py`. + +EV wie messung/grosse_calls/population.py (`ev_aktion`, Fold = 0, Raise zählt als Weiterspielen): + `eq` Flop/Turn: Equity gegen die gezeigte Hand des Erhöhers x Topf nach Rake - Call (ohne spätere Einsätze). + `real` was die Population mit dem Weiterspielen wirklich gewann: Ausgang x Endtopf nach Rake - alles, was sie ab + diesem Spot noch einzahlte (spätere Einsätze und Folds der Population inbegriffen; sie spielt weiter, nicht wir). +Gewicht `w`: Muck-IPW aus den Spots (1/g je Rolle). Intervall: 95 %-Bootstrap über die Erhöher (pid_o). + + python -I -X utf8 messung/pruefstand/posterior_bewerten.py ... [--boot 1000] [--json aus.json] +""" +import collections +import json +import os +import sys + +import numpy as np + +_HIER = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.join(_HIER, "..", "grosse_calls")) +sys.path.insert(0, os.path.join(_HIER, "..", "..", "lesen")) +import population as P # noqa: E402 +import leckfinder as lf # noqa: E402 + + +def ev_real(sp, aktion): + a = str(aktion or "").upper() + if a in ("FOLD", "ABSTAIN", ""): + return 0.0 + return sp["ausg"] * lf.nach_rake(sp["topf_end"]) - (sp["inv_end"] - sp["inv_spot"]) + + +def filter_von(sp): + st = "flop" if sp["strasse"] == 1 else "turn" + f = [st, sp["klasse"], "%s_%s" % (st, sp["klasse"])] + f.append("reg_setzer" if sp["reg_o"] else "kein_reg_setzer") + f.append("typ_" + sp["typ"]) + f.append("tp" if sp["klasse"] == "top_paar" else "besser_als_tp") + return f + + +def main(a): + boot = int(a[a.index("--boot") + 1]) if "--boot" in a else 1000 + aus = a[a.index("--json") + 1] if "--json" in a else None + pos = [x for i, x in enumerate(a) if not x.startswith("--") and (i == 0 or a[i - 1] not in ("--boot", "--json"))] + spots, dateien = pos[0], pos[1:] + S = {} + for z in open(spots, encoding="utf-8"): + sp = json.loads(z) + sp.pop("req", None) + S[sp["id"]] = sp + A = [{json.loads(z)["id"]: json.loads(z) for z in open(d, encoding="utf-8")} for d in dateien] + namen = [os.path.basename(d).replace(".jsonl", "") for d in dateien] + T = {m: collections.defaultdict(lambda: collections.defaultdict(lambda: np.zeros(len(A) - 1))) for m in ("eq", "real")} + kipp = collections.Counter() + fold_anteil = collections.defaultdict(lambda: np.zeros(len(A))) + n_f = collections.Counter() + ahead = collections.defaultdict(lambda: [0.0, 0.0]) + for i, sp in S.items(): + if not all(i in x for x in A): + continue + akt = [x[i].get("action") for x in A] + for f in filter_von(sp) + ["alle"]: + fold_anteil[f] += sp["w"] * np.array([1.0 if str(x).upper() in ("FOLD", "ABSTAIN") else 0.0 for x in akt]) + n_f[f] += sp["w"] + ahead[f][0] += sp["w"] * (1.0 if sp["eq"] is not None and sp["eq"] >= 0.5 else 0.0) + ahead[f][1] += sp["w"] + for k in range(1, len(A)): + if str(akt[0]).upper() != str(akt[k]).upper(): + kipp["%s: %s->%s" % (namen[k], akt[0], akt[k])] += 1 + for m, fn in (("eq", lambda x: P.ev_aktion(sp, x[i].get("action"), x[i].get("size"))), ("real", lambda x: ev_real(sp, x[i].get("action")))): + ev = [sp["w"] * fn(x) for x in A] + d = np.array([e - ev[0] for e in ev[1:]]) + for f in filter_von(sp) + ["alle"]: + T[m][f][sp["pid_o"]] += d + rng = np.random.default_rng(7) + erg = {"arme": namen, "kipps": dict(kipp), "fold": {}, "vorne": {}, "delta": {}} + for f in sorted(n_f): + erg["fold"][f] = [round(float(x / n_f[f]), 3) for x in fold_anteil[f]] + erg["vorne"][f] = round(ahead[f][0] / max(ahead[f][1], 1e-9), 3) + for m in T: + erg["delta"][m] = {} + for f in sorted(T[m]): + mat = np.array(list(T[m][f].values())) + s = mat.sum(0) + idx = rng.integers(0, len(mat), size=(boot, len(mat))) + b = np.stack([mat[j].sum(0) for j in idx]) + lo, hi = np.percentile(b, 2.5, axis=0), np.percentile(b, 97.5, axis=0) + erg["delta"][m][f] = {"setzer": len(mat), **{n: [round(float(s[k]), 1), round(float(lo[k]), 1), round(float(hi[k]), 1)] + for k, n in enumerate(namen[1:])}} + print("Arme:", namen) + print("Kipps:", dict(kipp.most_common(12))) + print("%-24s %8s %s" % ("Filter", "vorne", "Fold-Anteil je Arm")) + for f in sorted(n_f): + print("%-24s %8.3f %s" % (f, erg["vorne"][f], " ".join("%.3f" % x for x in erg["fold"][f]))) + for m in T: + print("\nDelta gegen %s (bb, Summe, 95 %%) Mass %s" % (namen[0], m)) + for f, d in erg["delta"][m].items(): + print("%-24s setzer %5d " % (f, d["setzer"]) + " ".join("%s %+7.0f [%+.0f, %+.0f]" % (n, *d[n]) for n in namen[1:])) + if aus: + json.dump(erg, open(aus, "w", encoding="utf-8", newline="\n"), indent=1, ensure_ascii=False) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/messung/pruefstand/posterior_spots.py b/messung/pruefstand/posterior_spots.py new file mode 100644 index 00000000..aaa83414 --- /dev/null +++ b/messung/pruefstand/posterior_spots.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +"""POSTERIOR auf echten Spots, Schritt 1: Flop-/Turn-Spots, in denen der Entscheider auf dieser Strasse gesetzt hat und +erhoeht wurde (Linie `geraist` aus messung/grosse_calls/population.py), Hand des Entscheiders Top-Paar oder besser. + +Der Erhoeher bekommt den Read, den der Laeufer live schickt (GEGNER_ZAEHLUNG=raise): `reads.raiseToBet` mit n Faellen, +k Erhoehungen (Vorgabe n=1, k=0 wie im Owner-Fall 180165100008). Mit POOL_STUFE=rtb liegt die Schaetzung dann bei +~0,10 (selten erhoehend) und POSTERIOR S2 greift voll. + + python -I -X utf8 messung/pruefstand/posterior_spots.py [--n 1 --k 0] + +Spots enthalten keine Namen (nur Hashes) und bleiben ausserhalb des Repos. +""" +import json +import os +import sys + +_hier = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, os.path.join(_hier, "..", "..", "lesen")) +import poolruf_eichung as pe # noqa: E402 + +AB_KLASSE = 3 # top_paar + + +def main(a): + ein, aus = a[0], a[1] + n = int(a[a.index("--n") + 1]) if "--n" in a else 1 + k = int(a[a.index("--k") + 1]) if "--k" in a else 0 + z = 0 + with open(aus, "w", encoding="utf-8", newline="\n") as f: + for zeile in open(ein, encoding="utf-8"): + if '"geraist"' not in zeile: + continue + sp = json.loads(zeile) + if sp["strasse"] not in (1, 2) or "geraist" not in sp["linien"]: + continue + kl = pe.klasse(sp["held"], sp["brett"]) + if kl < AB_KLASSE: + continue + sp["klasse"] = pe.KLASSEN[kl] + for v in sp["req"]["villains"]: + if not v.get("folded"): + pr = v.setdefault("profile", {"hands": 1}) + pr["reads"] = {"raiseToBet": {"n": n, "k": k}} + f.write(json.dumps(sp, separators=(",", ":")) + "\n") + z += 1 + print(z, "Spots") + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/messung/pruefstand/tor/posterior-fluss/TOR.md b/messung/pruefstand/tor/posterior-fluss/TOR.md new file mode 100644 index 00000000..a8460c5c --- /dev/null +++ b/messung/pruefstand/tor/posterior-fluss/TOR.md @@ -0,0 +1,32 @@ +# Tor echt: `POSTERIOR=bluff,schutz,beleg,fluss` + +**Urteil: DURCHGEFALLEN** + +- Verlierer: Pflichtfälle: 1 harte Verlierer + +## 1 EV auf echten NL2-Spots (Caller-Sicht, bb, 95 %-Bootstrap über die Setzer) + +| Teil | Spots | Δ alle | Flop | Turn | River | geänderte Aktionen | +|---|---|---|---|---|---|---| +| dev | 16152 | +0 [+0, +0] | +0 [+0, +0] | +0 [+0, +0] | +0 [+0, +0] | | +| holdout | 18338 | +0 [+0, +0] | +0 [+0, +0] | +0 [+0, +0] | +0 [+0, +0] | | +| post-dev.jsonl | 10737 | +37261 [+30789, +45052] | +36712 [+29818, +43595] | +549 [+58, +1177] | – | flop FOLD->CALL 793, flop CALL->RAISE 190, flop FOLD->RAISE 38, turn FOLD->CALL 8 | +| post-holdout.jsonl | 12340 | +53383 [+45355, +61730] | +53572 [+46084, +61811] | -188 [-489, +30] | – | flop FOLD->CALL 1287, flop CALL->RAISE 421, flop FOLD->RAISE 69, turn FOLD->CALL 8 | + +## 2 Pflichtfälle + +DURCHGEFALLEN: Soll Live 35/43, Arm 34/43, Ziele behoben 0/6, harte Verlierer 1 +- 178543200043 FLOP: live RAISE -> RAISE (trips on dry board: equity 0.82 vs break-even 0.29, EV raise to 1.75 +0.59) + +## 3 Eigen-Replay (eigene Kern-Anfragen aus den Schatten-Logs) + +11449 Anfragen, 14 anders: FLOP FOLD->CALL 9, FLOP FOLD->RAISE 2, TURN FOLD->CALL 2, RIVER FOLD->CALL 1 +Prämie zum Fold: 0; Pflichtregel-Brüche: 0 + +## 4 Kipp-Liste (Raster: 169 Starthände je Lage, Postflop je Handklasse) + +29758 Spots, 37 gekippt, 9 nur Größe, **0 hart**; Richtungen: FOLD->CALL 32, CALL->RAISE 3, CALL->FOLD 1, RAISE->CALL 1 + +## 5 LBR (S1, gepaart) + +{"haende": 40, "bitgleich": true, "delta_bb100": 0.0, "ci_bb100": [0.0, 0.0], "live_bb100": 255.25} diff --git a/messung/pruefstand/tor/posterior-fluss/lbr-arm.txt b/messung/pruefstand/tor/posterior-fluss/lbr-arm.txt new file mode 100644 index 00000000..1c3292ac --- /dev/null +++ b/messung/pruefstand/tor/posterior-fluss/lbr-arm.txt @@ -0,0 +1,40 @@ +0 2.5 +3 2.5 +1 2.5 +6 -4.15 +5 2.5 +2 2.5 +7 2.5 +4 2.5 +9 2.5 +11 2.5 +12 2.5 +13 2.5 +15 -2.5 +8 2.5 +16 -4.15 +10 -4.15 +18 -4.15 +14 2.5 +21 2.5 +20 4.15 +22 -2.5 +17 6.25 +23 2.5 +19 12.5 +27 -2.5 +24 4.15 +28 -6.25 +25 12.5 +29 2.5 +30 2.5 +26 4.15 +32 2.5 +31 2.5 +33 2.5 +35 2.5 +34 18.75 +37 2.5 +36 6.25 +39 2.5 +38 6.25 diff --git a/messung/pruefstand/tor/posterior-fluss/lbr-live.txt b/messung/pruefstand/tor/posterior-fluss/lbr-live.txt new file mode 100644 index 00000000..03f497ba --- /dev/null +++ b/messung/pruefstand/tor/posterior-fluss/lbr-live.txt @@ -0,0 +1,40 @@ +0 2.5 +3 2.5 +1 2.5 +6 -4.15 +5 2.5 +2 2.5 +7 2.5 +4 2.5 +9 2.5 +11 2.5 +12 2.5 +13 2.5 +15 -2.5 +8 2.5 +16 -4.15 +10 -4.15 +18 -4.15 +14 2.5 +21 2.5 +20 4.15 +22 -2.5 +17 6.25 +23 2.5 +19 12.5 +27 -2.5 +24 4.15 +28 -6.25 +25 12.5 +30 2.5 +26 4.15 +29 2.5 +32 2.5 +31 2.5 +33 2.5 +35 2.5 +34 18.75 +37 2.5 +36 6.25 +39 2.5 +38 6.25 diff --git a/messung/pruefstand/tor/posterior-fluss/tor.json b/messung/pruefstand/tor/posterior-fluss/tor.json new file mode 100644 index 00000000..6ee92895 --- /dev/null +++ b/messung/pruefstand/tor/posterior-fluss/tor.json @@ -0,0 +1,342 @@ +{ + "arm": "POSTERIOR=bluff,schutz,beleg,fluss", + "aenderung": { + "POSTERIOR": "bluff,schutz,beleg,fluss" + }, + "ev": { + "dev": { + "spots": 16152, + "anders": {}, + "delta": { + "alle": [ + 0.0, + 0.0, + 0.0, + 3605 + ], + "river": [ + 0.0, + 0.0, + 0.0, + 2052 + ], + "turn": [ + 0.0, + 0.0, + 0.0, + 2338 + ], + "flop": [ + 0.0, + 0.0, + 0.0, + 1655 + ] + } + }, + "holdout": { + "spots": 18338, + "anders": {}, + "delta": { + "alle": [ + 0.0, + 0.0, + 0.0, + 4241 + ], + "turn": [ + 0.0, + 0.0, + 0.0, + 2689 + ], + "river": [ + 0.0, + 0.0, + 0.0, + 2402 + ], + "flop": [ + 0.0, + 0.0, + 0.0, + 1858 + ] + } + } + }, + "ev_extra": { + "post-dev.jsonl": { + "spots": 10737, + "anders": { + "flop FOLD->CALL": 793, + "flop CALL->RAISE": 190, + "flop FOLD->RAISE": 38, + "turn FOLD->CALL": 8, + "flop RAISE->CALL": 4, + "flop CALL->FOLD": 3, + "turn CALL->RAISE": 3, + "turn ABSTAIN->RAISE": 2, + "turn RAISE->CALL": 1 + }, + "delta": { + "alle": [ + 37260.7, + 30788.9, + 45051.9, + 2863 + ], + "flop": [ + 36711.5, + 29817.9, + 43594.7, + 2059 + ], + "turn": [ + 549.2, + 58.3, + 1177.0, + 1930 + ] + } + }, + "post-holdout.jsonl": { + "spots": 12340, + "anders": { + "flop FOLD->CALL": 1287, + "flop CALL->RAISE": 421, + "flop FOLD->RAISE": 69, + "turn FOLD->CALL": 8, + "flop CALL->FOLD": 7, + "flop RAISE->CALL": 7, + "turn CALL->RAISE": 3, + "turn RAISE->CALL": 3, + "flop ABSTAIN->CALL": 1, + "turn FOLD->ABSTAIN": 1, + "flop ABSTAIN->RAISE": 1, + "flop CALL->ABSTAIN": 1 + }, + "delta": { + "alle": [ + 53383.3, + 45355.4, + 61729.8, + 3358 + ], + "turn": [ + -188.2, + -488.7, + 29.9, + 2181 + ], + "flop": [ + 53571.6, + 46084.4, + 61811.2, + 2397 + ] + } + } + }, + "pflicht": { + "bestanden": false, + "verlierer": 1, + "n": 43, + "live_soll": 35, + "kandidat_soll": 34, + "ziele_behoben": 0, + "ziele": 6, + "verlierer_faelle": [ + { + "hand": "178543200043", + "street": "FLOP", + "live": "RAISE", + "kandidat": "RAISE", + "grund": "trips on dry board: equity 0.82 vs break-even 0.29, EV raise to 1.75 +0.59" + } + ] + }, + "replay": { + "anfragen": 11449, + "anders": 14, + "richtung": { + "FLOP FOLD->CALL": 9, + "FLOP FOLD->RAISE": 2, + "TURN FOLD->CALL": 2, + "RIVER FOLD->CALL": 1 + }, + "praemie_zum_fold": [], + "n_praemie_zum_fold": 0, + "pflichtregel_bruch": [], + "n_pflichtregel_bruch": 0, + "beispiele": [ + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1783945|178394500442|FLOP|0.24|0.08|QHSH|()", + "street": "FLOP", + "hand": "Qh6h", + "klasse": "top_paar", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "top pair weak kicker on medium board: equity 0.64 vs break-even 0.26, EV call +0.11" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1784759|178475900270|FLOP|0.42|0.18|ACTC|()", + "street": "FLOP", + "hand": "Ac3c", + "klasse": "top_paar", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "top pair weak kicker on medium board: equity 0.63 vs break-even 0.32, EV call +0.18" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1785004|178500400069|FLOP|0.21|0.09|QDTS|()", + "street": "FLOP", + "hand": "QdTs", + "klasse": "paar_schwach", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "middle pair on medium board (2-way): equity 0.39 vs break-even 0.32, EV call +0.02" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1784931|178493100165|FLOP|0.56|0.28|ESAH|()", + "street": "FLOP", + "hand": "8sAh", + "klasse": "top_paar", + "live": "FOLD", + "arm": "RAISE", + "grund_arm": "top pair good kicker on medium board: equity 0.62 vs break-even 0.35, EV raise to 0.64 +0.26" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1789081|178908100678|FLOP|0.28|0.12|FDAH|()", + "street": "FLOP", + "hand": "4dAh", + "klasse": "paar_schwach", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "middle pair on dry board: equity 0.51 vs break-even 0.32, EV call +0.07" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1790035|179003500241|FLOP|0.31|0.08|EHES|()", + "street": "FLOP", + "hand": "8h8s", + "klasse": "paar_schwach", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "middle pair on medium board (2-way): equity 0.34 vs break-even 0.22, EV call +0.04" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1789081|178908100715|FLOP|0.2|0.06|ACSD|()", + "street": "FLOP", + "hand": "Ac7d", + "klasse": "paar_schwach", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "middle pair on dry board (2-way): equity 0.38 vs break-even 0.24, EV call +0.03" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1789078|178907801550|TURN|3.78|0.98|AHEH|()", + "street": "TURN", + "hand": "Ah8h", + "klasse": "paar_schwach", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "middle pair with combo draw on medium board: equity 0.45 vs break-even 0.25, EV call +0.77" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1794220|179422000199|FLOP|0.81|0.35|KCJS|()", + "street": "FLOP", + "hand": "KcJs", + "klasse": "top_paar", + "live": "FOLD", + "arm": "RAISE", + "grund_arm": "top pair good kicker on medium board: equity 0.68 vs break-even 0.32, EV raise to 1.28 +0.59" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1792602|179260200727|FLOP|1.11|0.65|QDQH|()", + "street": "FLOP", + "hand": "QdQh", + "klasse": "overpair", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "overpair on medium board: equity 0.49 vs break-even 0.39, EV call +0.16" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1794597|179459700036|FLOP|0.29|0.11|KSSS|()", + "street": "FLOP", + "hand": "Ks6s", + "klasse": "top_paar", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "top pair weak kicker on medium board (2-way): equity 0.43 vs break-even 0.29, EV call +0.05" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1795600|179560000003|RIVER|0.59|0.15|SCAC|()", + "street": "RIVER", + "hand": "7cAc", + "klasse": "top_paar", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "top pair weak kicker on four-flush board: equity 0.34 vs break-even 0.21, EV call +0.09" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1793205|179320500839|TURN|0.2|0.05|TCAH|()", + "street": "TURN", + "hand": "TcAh", + "klasse": "nichts", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "air on medium board (2-way): equity 0.29 vs break-even 0.21, EV call +0.02" + }, + { + "zug": "14R NL 0.01-0.02 EV-INRIT-(A) 1801651|180165100008|FLOP|0.53|0.22|KSJS|()", + "street": "FLOP", + "hand": "KsJs", + "klasse": "top_paar", + "live": "FOLD", + "arm": "CALL", + "grund_arm": "top pair good kicker on dry board: equity 0.65 vs break-even 0.31, EV call +0.24 | PAAR_RAISE: ein Paar gegen passiv gelesene Gegner -> kein Value-Raise" + } + ] + }, + "kipp": { + "arm": "POSTERIOR=bluff,schutz,beleg,fluss", + "spots": 29758, + "gekippt": 37, + "groesse": 9, + "hart": 0, + "richtung": { + "FOLD->CALL": 32, + "CALL->RAISE": 3, + "CALL->FOLD": 1, + "RAISE->CALL": 1 + }, + "klassen": { + "paar_schwach": 9, + "zug": 9, + "zwei_paar": 7, + "top_paar": 6, + "overpair": 3, + "nichts": 2, + "monster": 1 + }, + "lagen": { + "FLOP srp BTN": 37 + }, + "harte_beispiele": [] + }, + "lbr": { + "haende": 40, + "bitgleich": true, + "delta_bb100": 0.0, + "ci_bb100": [ + 0.0, + 0.0 + ], + "live_bb100": 255.25 + }, + "urteil": "DURCHGEFALLEN", + "gruende": [ + "Pflichtfälle: 1 harte Verlierer" + ], + "offen": [] +} \ No newline at end of file diff --git a/src/engine/bluff.rs b/src/engine/bluff.rs index 7b2dd0b9..d680668f 100644 --- a/src/engine/bluff.rs +++ b/src/engine/bluff.rs @@ -174,3 +174,33 @@ pub fn bluff_catch_blocked(spot: &Spot, read: &HandRead) -> bool { && !has_real_draw(read, spot.street) && bettor(spot).is_some_and(|(_, c)| read.made < c.min_made && c.bluff_share < MIN_BLUFF_SHARE) } + +/// Vermerk (text only) for a call removed by `bluff_catch_blocked`: the bettor's bluff share, the hand +/// against his value floor, and which switch pushed the share under `MIN_BLUFF_SHARE` - POSTERIOR when +/// the same continuation without it would clear the bar (counterfactual, override restored), else +/// TURN_RAISE_NUR on a turn raise, else the range model. +pub fn bluff_catch_vermerk(spot: &Spot, read: &HandRead) -> String { + let Some((v, c)) = bettor(spot) else { return "Bluff-Fang gesperrt -> fold".into() }; + let before = super::glaube::current_override(); + let ohne = super::glaube::mode().is_some_and(|m| m.bluff).then(|| { + super::glaube::set_override(Some(None)); + let x = bettor(spot).map(|(_, c)| c.bluff_share); + super::glaube::set_override(before); + x + }); + let ohne = ohne.flatten(); + let raised = spot + .history + .iter() + .filter(|r| r.street == spot.street && r.action.is_aggressive()) + .count() + >= 2; + let wer = match ohne { + Some(x) if x >= MIN_BLUFF_SHARE => format!("POSTERIOR: {} selten geblufft (Bluffanteil {:.3}, ohne POSTERIOR {x:.3})", if raised { "Raise" } else { "Einsatz" }, c.bluff_share), + _ if raised && spot.street == crate::game::Street::Turn && crate::exploit::street_continuation::tighten_for(v) => { + format!("TURN_RAISE_NUR: Turn-Raise ohne Bluffs (Bluffanteil {:.3})", c.bluff_share) + } + _ => format!("Range-Modell: Bluffanteil {:.3}", c.bluff_share), + }; + format!("{wer} < {MIN_BLUFF_SHARE:.2}, {:?} unter Wertgrenze {:?} -> kein Bluff-Fang -> fold", read.made, c.min_made) +} diff --git a/src/engine/decide.rs b/src/engine/decide.rs index 93d9b7ea..d2e7ecc6 100644 --- a/src/engine/decide.rs +++ b/src/engine/decide.rs @@ -84,7 +84,8 @@ fn postflop(spot: &Spot, thresholds: &Thresholds, raw: &Spot, premium: f64) -> D crate::exploit::fold_chance::set_ueberbet_hand(super::options::holds_one_pair(spot, &hand_read)); super::check_falle::merke_roh(raw); let base = choose_postflop_with(spot, &equity, &called_equity(spot), thresholds, &hand_read); - let floored = crate::exploit::mdf_floor::floor(raw, hand_read.made, base).with_equity(equity.share); + let floored = crate::exploit::mdf_floor::floor(raw, hand_read.made, base.clone()).with_equity(equity.share); + let floored = super::vermerk::ersetzt(&base, floored); // Defensive river veto (the belief+trust gearbox, CASH ONLY): a confident read that the // villain UNDER-bluffs its river bet turns a heuristic call into a fold. This is the one // place the gearbox is a proven edge — the heuristic over-calls under-bluffed overbets @@ -124,7 +125,7 @@ fn postflop(spot: &Spot, thresholds: &Thresholds, raw: &Spot, premium: f64) -> D // heuristic. let e3 = if super::turn_game::turn_ueberall() { None } else { super::turn_game::turn_game_decision(raw) }; if let Some(d) = e3 { - return d.with_equity(equity.share); + return super::vermerk::ersetzt(&floored, d.with_equity(equity.share)); } // Stage B, solver everywhere (off by default, SOLVER_TURN): every heads-up turn. if let Some(d) = super::turn_game::turn_solver_decision(raw) { @@ -140,7 +141,8 @@ fn postflop(spot: &Spot, thresholds: &Thresholds, raw: &Spot, premium: f64) -> D return d.with_equity(equity.share); } // Bounded exploitation of the non-station reads (`read_exploit`, switch GEGNER_BREIT, off). - return super::read_exploit::postflop(raw, &hand_read, super::river_subgame::fold_veto(raw, floored)); + let vetoed = super::vermerk::ersetzt(&floored, super::river_subgame::fold_veto(raw, floored.clone())); + return super::read_exploit::postflop(raw, &hand_read, vetoed); } floored } @@ -258,7 +260,17 @@ fn decide_matched(spot: &Spot, lage: Option<&Turnierlage>) -> Decision { force(Some(1)); let demoted = decide_one(spot, lage); force(before); - return if aggression_rank(demoted.choice) < aggression_rank(station.choice) { demoted } else { station }; + return if aggression_rank(demoted.choice) < aggression_rank(station.choice) { + let note = format!( + "STATION_POSTFLOP schmal: mit Stations-Read {}, blind {} -> {}", + super::vermerk::aktion(&station.choice), + super::vermerk::aktion(&demoted.choice), + super::vermerk::aktion(&demoted.choice) + ); + super::vermerk::anhaengen(demoted, &[note]) + } else { + station + }; } decide_one(spot, lage) } @@ -273,7 +285,13 @@ fn aggression_rank(c: Choice) -> u8 { } } +/// One decision in its own vermerk frame: the notes of overriding rules are appended to the reason. fn decide_one(spot: &Spot, lage: Option<&Turnierlage>) -> Decision { + super::vermerk::beginne(); + super::vermerk::abschliessen(decide_one_inner(spot, lage)) +} + +fn decide_one_inner(spot: &Spot, lage: Option<&Turnierlage>) -> Decision { // RAKE_LIVE (`rake::live`, off by default): a cash spot prices every pot net of the room's rake; // a tournament pays none, also a chip-linear one that plays the cash path below // (the scope is decided on the original situation). Off: no scope, nothing changes. diff --git a/src/engine/from_plan.rs b/src/engine/from_plan.rs index 27b3c78b..020c9050 100644 --- a/src/engine/from_plan.rs +++ b/src/engine/from_plan.rs @@ -37,11 +37,24 @@ fn commit_begrenzt(spot: &Spot, plan: &PreflopPlan, choice: Option) -> O match choice { Some(Choice::Raise { to }) if plan.action == ChartAction::Raise => { let jam = all_in(spot).unwrap_or(to); - match raise_commitment(plan.percentile, to, jam, spot.to_call, spot.pot) { + let out = match raise_commitment(plan.percentile, to, jam, spot.to_call, spot.pot) { RaiseVerdict::Keep => Some(Choice::Raise { to }), RaiseVerdict::Downgrade => cheapest_continue(spot).or_else(|| give_up(spot)), RaiseVerdict::Fold => give_up(spot), + }; + match out { + Some(Choice::Raise { .. }) => { + if crate::preflop::vorflop_pop::ziel(spot).is_some() { + super::vermerk::notiere(format!("VORFLOP_POP: Groesse nach NL2-Population, raise to {to:.2}")); + } + } + Some(c) => super::vermerk::notiere(format!( + "Commit-Riegel: raise to {to:.2} bindet den Stack -> {}", + super::vermerk::aktion(&c) + )), + None => {} } + out } other => other, } diff --git a/src/engine/glaube.rs b/src/engine/glaube.rs index 84495dde..df4f2b1d 100644 --- a/src/engine/glaube.rs +++ b/src/engine/glaube.rs @@ -74,6 +74,10 @@ pub struct Mode { /// `beleg`: S2 only as far as the read shows few raises (`evidence_weight`); an opponent without a /// counted `raise_to_bet` keeps the incoming share (micro gate 16.11.: nemesis-2@blind −36 unread). pub evidence: bool, + /// `fluss`: S2 only on the river; flop and turn keep the incoming bluff share. Pruefstand 18.11.: + /// on 10 737 real NL2 flop/turn raises against top pair or better S2 folded 21 % (without it 7 %) + /// while the caller was ahead 61 % of the time (`messung/pruefstand/POSTERIOR.md`). + pub river_only: bool, } thread_local! { @@ -107,7 +111,7 @@ pub fn mode() -> Option { } fn parse(s: &str) -> Option { - let mut m = Mode { fold: false, board_weight: 1.0, fold_only_branch: false, class_rate: false, bluff: false, river_lines_only: false, guard: false, evidence: false }; + let mut m = Mode { fold: false, board_weight: 1.0, fold_only_branch: false, class_rate: false, bluff: false, river_lines_only: false, guard: false, evidence: false, river_only: false }; for t in s.split(',').map(str::trim) { if t == "fold" { m.fold = true; @@ -123,6 +127,8 @@ fn parse(s: &str) -> Option { m.guard = true; } else if t == "beleg" { m.evidence = true; + } else if t == "fluss" { + m.river_only = true; } else if let Some(w) = t.strip_prefix("fold:").and_then(|w| w.parse::().ok()).filter(|w| w.is_finite()) { m.fold = true; m.board_weight = w; @@ -136,6 +142,11 @@ pub fn set_override(mode: Option>) { OVERRIDE.with(|o| o.set(mode)); } +/// The current override (`set_override`), to restore it after a counterfactual (`bluff::bluff_catch_vermerk`). +pub fn current_override() -> Option> { + OVERRIDE.with(|o| o.get()) +} + /// Is S1 on? pub fn fold_on() -> bool { mode().is_some_and(|m| m.fold) @@ -298,6 +309,9 @@ fn class_fold(f: f64, m_board: f64, m_ref: f64) -> f64 { /// /// Off: `prior` unchanged. pub fn bluff(seat: u8, street: Street, ratio: Option, line: Option<&Line>, prior: f64) -> f64 { + if street != Street::River && mode().is_some_and(|m| m.river_only) { + return prior; + } let s2 = line_bluff(seat, street, ratio, line, prior); let Some(m) = mode().filter(|m| m.bluff && (m.guard || m.evidence)) else { return s2 }; if street == Street::Preflop { @@ -406,6 +420,8 @@ mod tests { assert_eq!(guard_weight(&p(Some(0.2), Some(0.56))), 1.0); assert_eq!(parse("bluff,schutz").map(|m| (m.bluff, m.guard)), Some((true, true))); assert_eq!(parse("bluff,schutz,beleg").map(|m| m.evidence), Some(true)); + assert_eq!(parse("bluff,schutz,beleg,fluss").map(|m| (m.evidence, m.river_only)), Some((true, true))); + assert_eq!(parse("bluff,schutz,beleg").map(|m| m.river_only), Some(false)); assert_eq!(evidence_weight(&Profile::default()), 0.0, "no read: the incoming share"); assert_eq!(evidence_weight(&p(Some(0.30), None)), 0.0); assert!((evidence_weight(&p(Some(0.275), None)) - 0.5).abs() < 1e-9); @@ -414,9 +430,9 @@ mod tests { #[test] fn parses_the_stages() { - assert_eq!(parse("fold"), Some(Mode { fold: true, board_weight: 1.0, fold_only_branch: false, class_rate: false, bluff: false, river_lines_only: false, guard: false, evidence: false })); - assert_eq!(parse("fold:0.5,bluff"), Some(Mode { fold: true, board_weight: 0.5, fold_only_branch: false, class_rate: false, bluff: true, river_lines_only: false, guard: false, evidence: false })); - assert_eq!(parse("fold:0,nurfold"), Some(Mode { fold: true, board_weight: 0.0, fold_only_branch: true, class_rate: false, bluff: false, river_lines_only: false, guard: false, evidence: false })); + assert_eq!(parse("fold"), Some(Mode { fold: true, board_weight: 1.0, fold_only_branch: false, class_rate: false, bluff: false, river_lines_only: false, guard: false, evidence: false, river_only: false })); + assert_eq!(parse("fold:0.5,bluff"), Some(Mode { fold: true, board_weight: 0.5, fold_only_branch: false, class_rate: false, bluff: true, river_lines_only: false, guard: false, evidence: false, river_only: false })); + assert_eq!(parse("fold:0,nurfold"), Some(Mode { fold: true, board_weight: 0.0, fold_only_branch: true, class_rate: false, bluff: false, river_lines_only: false, guard: false, evidence: false, river_only: false })); assert_eq!(parse("0"), None); assert_eq!(parse(""), None); } diff --git a/src/engine/mod.rs b/src/engine/mod.rs index 91f123c6..4575efea 100644 --- a/src/engine/mod.rs +++ b/src/engine/mod.rs @@ -43,6 +43,7 @@ pub mod turn_subgame; pub mod ueberschuss; pub mod ueberwert; pub mod uncertainty; +pub mod vermerk; /// One lock for every unit test that flips a process-wide solver switch (`set_river_spieler`, /// `set_turn_ueberall`, `set_flop_spieler`, `set_river3`, `set_turn3`/`set_flop3`, `set_turn_player`): diff --git a/src/engine/options.rs b/src/engine/options.rs index bf125464..2f4a0f17 100644 --- a/src/engine/options.rs +++ b/src/engine/options.rs @@ -254,16 +254,59 @@ fn reraise_rate(spot: &Spot) -> f64 { .clamp(0.0, 1.0) } -/// What kind of raise this hand could make here, if any. -fn raise_kind(spot: &Spot, eff: &Effective, read: &HandRead) -> Option { - let nie = never_folds(spot); - let bluffable = eff.raise_ok && !nie; - let pair_blocked = match paar_raise() { +/// `PAAR_RAISE`: the value raise of a one-pair hand facing a bet is blocked here. +fn pair_blocked(spot: &Spot, read: &HandRead) -> bool { + match paar_raise() { Some(PaarRaise::Nie) => one_pair_facing_bet(spot, read), Some(PaarRaise::Passiv(bar)) => one_pair_facing_bet(spot, read) && all_passive(spot, bar, false), Some(PaarRaise::Gelesen(bar)) => one_pair_facing_bet(spot, read) && all_passive(spot, bar, true), _ => false, - }; + } +} + +/// Vermerke (text only): which switch-driven option gate shaped this decision. `winner` is the chosen +/// option; notes go to `engine::vermerk`. +pub fn vermerke(spot: &Spot, eff: &Effective, read: &HandRead, winner: Option<&Scored>) { + use super::vermerk::notiere; + let raised = matches!(winner.map(|w| w.choice), Some(Choice::Raise { .. })); + if !raised && is_value_raise(eff) && pair_blocked(spot, read) { + notiere("PAAR_RAISE: ein Paar gegen passiv gelesene Gegner -> kein Value-Raise"); + } + // The call was taken out of the options (`scored`): say which gate did it. + if winner.is_some_and(|w| w.choice == Choice::Fold) && spot.is_legal(ActionKind::Call) { + let be = break_even(spot.pot, spot.to_call); + let extra = extra_call_margin(spot, read); + let need = be + eff.call_margin + extra; + if eff.share < need { + notiere(format!( + "Call-Schwelle: Equity {:.2} < Break-even {be:.2} + Marge {:.2} -> fold", + eff.share, + eff.call_margin + extra + )); + } else if bluff_catch_blocked(spot, read) { + notiere(super::bluff::bluff_catch_vermerk(spot, read)); + } + } + if let Some(w) = winner.filter(|_| raised) { + if w.kind == Some(RaiseKind::Value) && river_monster(spot, eff, read) && !(is_value_raise(eff) && !pair_blocked(spot, read)) { + notiere("FLUSS_WERT: River-Monster bekommt die Wert-Wette"); + } + if w.kind == Some(RaiseKind::Bluff) && super::cbet_luft::applies(spot).is_some() { + notiere("CBET_LUFT: Luft-C-Bet gegen seltenen Erhoeher"); + } + if let (Choice::Raise { to }, Some(kind)) = (w.choice, w.kind) { + if super::ueberwert::groesse(spot, kind).is_some_and(|g| (g - to).abs() < 1e-9) { + notiere("UEBERWERT: River-Value ab Perzentil 0,90 -> 2x Topf"); + } + } + } +} + +/// What kind of raise this hand could make here, if any. +fn raise_kind(spot: &Spot, eff: &Effective, read: &HandRead) -> Option { + let nie = never_folds(spot); + let bluffable = eff.raise_ok && !nie; + let pair_blocked = pair_blocked(spot, read); if (is_value_raise(eff) && !pair_blocked) || river_monster(spot, eff, read) { Some(RaiseKind::Value) } else if thin_value(eff, read.made, spot.street, spot.is_legal(ActionKind::Check)) { diff --git a/src/engine/postflop.rs b/src/engine/postflop.rs index 4ed50b90..3adb84fe 100644 --- a/src/engine/postflop.rs +++ b/src/engine/postflop.rs @@ -150,6 +150,21 @@ fn marginal_raise( (gap < error).then_some((gap, error)) } +/// `ENTHALTUNG=passiv` (off by default = bit-identical): a semibluff/bluff raise whose EV lead over the +/// best passive line is inside its error no longer ABSTAINs (the runner turns an ABSTAIN facing a bet +/// into FOLD, `betrieb/runner.py::nie_verstreichen`), it plays the best passive option the option gates +/// kept (check, call, else fold). Pruefstand 18.11.: Jc7s on JhTd8c, equity 0.58 vs break-even 0.32, +/// call +0.16, folded because a 0.72 semibluff led by +0.00 (`messung/pruefstand/BERICHT.md`). +fn passiv_statt_enthaltung(options: &[Scored]) -> Option { + use std::sync::OnceLock; + static AN: OnceLock = OnceLock::new(); + if !*AN.get_or_init(|| std::env::var("ENTHALTUNG").is_ok_and(|v| v.trim() == "passiv")) { + return None; + } + let passiv: Vec = options.iter().copied().filter(|o| !matches!(o.choice, Choice::Raise { .. })).collect(); + best(&passiv) +} + /// `choose_postflop_with` when nothing is known about the calling range: the whole /// range calls, so the called branch uses the overall share. pub fn choose_postflop( @@ -207,6 +222,15 @@ pub fn choose_postflop_with( // that on fold equity (semibluff, bluff) are held back by the error. let held = kind != Some(RaiseKind::Value); if let Some((gap, error)) = held.then(|| marginal_raise(spot, &eff, estimate, to, raise_ev)).flatten() { + if let Some(p) = passiv_statt_enthaltung(&options) { + super::options::vermerke(spot, &eff, read, Some(&p)); + super::vermerk::notiere(format!("ENTHALTUNG: Raise im Fehler -> {}", super::vermerk::aktion(&p.choice))); + return priced(Decision::new( + p.choice, + abstain_confidence(gap, error), + format!("{head}: raise EV lead {gap:+.2} inside its error {error:.2}, EV {} {:+.2}", label(p.choice, p.kind), p.ev), + )); + } return priced(Decision::new( Choice::Abstain, abstain_confidence(gap, error), @@ -229,6 +253,8 @@ pub fn choose_postflop_with( // The abstain gate above decided WHETHER to raise on the best size; once committed, mix the // SIZE among EV-tied raises so the line is not a readable pure argmax (EV-neutral, seeded). let winner = winner.map(|w| mix_size(spot, estimate, &options, w)); + // Vermerke (text only): option gates of switches that shaped this winner (`engine::vermerk`). + super::options::vermerke(spot, &eff, read, winner.as_ref()); priced(match winner { Some(w) => { let shown = match w.choice { diff --git a/src/engine/vermerk.rs b/src/engine/vermerk.rs new file mode 100644 index 00000000..9be58a98 --- /dev/null +++ b/src/engine/vermerk.rs @@ -0,0 +1,107 @@ +//! Vermerke: every rule that overrides the base calculation names itself in the reason (Auftrag 18.11., +//! Pruefstand). The owner saw "EV call +0.16" on a FOLD (180165100008, KsJs facing a flop raise): the +//! call had been removed by the bluff-catch block after POSTERIOR pushed the raiser's bluff share +//! under 0.05, and nothing said so. +//! +//! A rule calls `notiere("SCHALTER: was -> aktion")` where it changes the action; `decide_one` opens a +//! frame (`beginne`) and appends the frame's notes to the final reason (`abschliessen`) as +//! `" | note | note"`. Frames stack, so a nested decision (the station two-way pick, a solver +//! asking the core) keeps its own notes. TEXT ONLY: no note changes a choice, a size or a number. + +use crate::game::Decision; +use std::cell::RefCell; + +thread_local! { + static RAHMEN: RefCell>> = const { RefCell::new(Vec::new()) }; +} + +/// Opens a frame for one decision. +pub fn beginne() { + RAHMEN.with(|r| r.borrow_mut().push(Vec::new())); +} + +/// Notes `text` in the innermost open frame (no frame: dropped). The same text twice is kept once. +pub fn notiere(text: impl Into) { + let text = text.into(); + RAHMEN.with(|r| { + if let Some(top) = r.borrow_mut().last_mut() { + if !top.contains(&text) { + top.push(text); + } + } + }); +} + +/// Closes the innermost frame and appends its notes to `decision.reason`. +pub fn abschliessen(decision: Decision) -> Decision { + let notes = RAHMEN.with(|r| r.borrow_mut().pop()).unwrap_or_default(); + anhaengen(decision, ¬es) +} + +/// `reason | n1 | n2`; no notes: unchanged. +pub fn anhaengen(decision: Decision, notes: &[String]) -> Decision { + if notes.is_empty() { + return decision; + } + let reason = format!("{} | {}", decision.reason, notes.join(" | ")); + Decision { reason, ..decision } +} + +/// A stage that may replace `before` with `after`: when the action changed and the stage did not say +/// so itself (the reason is still `before`'s), note `name: before -> after`. +pub fn stufe(name: &str, before: &Decision, after: Decision) -> Decision { + if after.choice != before.choice && after.reason == before.reason { + notiere(format!("{name}: {} -> {}", aktion(&before.choice), aktion(&after.choice))); + } + after +} + +/// A stage that replaced `before` with its own decision and reason (MDF floor, river veto, turn game): +/// when the action changed, keep the base reason in front, `base | stage`, so the base numbers stay +/// visible. Same action, or the stage already carries the base reason: `after` unchanged. +pub fn ersetzt(before: &Decision, after: Decision) -> Decision { + if after.choice == before.choice { + return after; + } + if after.reason == before.reason { + return stufe("Stufe", before, after); + } + if after.reason.starts_with(&before.reason) { + return after; + } + let reason = format!("{} | {}", before.reason, after.reason); + Decision { reason, ..after } +} + +/// Lower-case action word for notes. +pub fn aktion(c: &crate::game::Choice) -> String { + c.name().to_lowercase() +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::game::Choice; + + #[test] + fn notes_are_appended_once_and_frames_nest() { + beginne(); + notiere("A: x -> fold"); + beginne(); + notiere("B"); + let inner = abschliessen(Decision::new(Choice::Call, 0.5, "inner")); + assert_eq!(inner.reason, "inner | B"); + notiere("A: x -> fold"); + let outer = abschliessen(Decision::new(Choice::Fold, 0.5, "outer")); + assert_eq!(outer.reason, "outer | A: x -> fold"); + assert_eq!(outer.choice, Choice::Fold); + } + + #[test] + fn no_frame_no_note() { + notiere("lost"); + beginne(); + let d = abschliessen(Decision::new(Choice::Check, 0.5, "r")); + assert_eq!(d.reason, "r"); + } +} diff --git a/src/exploit/street_continuation.rs b/src/exploit/street_continuation.rs index 56c3dfbf..b115306e 100644 --- a/src/exploit/street_continuation.rs +++ b/src/exploit/street_continuation.rs @@ -197,7 +197,7 @@ pub fn note_raw_reads(spot: &Spot) { ROH.with(|r| r.set(mask)); } -fn tighten_for(villain: &Villain) -> bool { +pub fn tighten_for(villain: &Villain) -> bool { match nur_modus() { NurModus::Alle => true, NurModus::Gelesen => villain.profile.is_some(), diff --git a/werkzeuge/kippliste.py b/werkzeuge/kippliste.py new file mode 100644 index 00000000..cef793d3 --- /dev/null +++ b/werkzeuge/kippliste.py @@ -0,0 +1,494 @@ +#!/usr/bin/env python3 +"""Kipp-Liste je Schalter: welche Handklassen kippt ein Kern-Schalter, und kippt er eine Prämienhand zum Fold? + +Das alte Tor sah nur die paar Replay-Hände, die ein Schalter zufällig änderte (VORFLOP_POP vs3bet: 8 Hände, AJo gegen eine +SB-3-Bet 4,6x fiel erst im Owner-Lauf auf). Hier läuft ein festes Raster durch den Kern: + + Vorflop alle 169 Starthände je Lage: Open (5 Positionen), gegen Open (15 Paare), gegen 3-Bet (15), gegen 4-Bet (15), + gegen Limp (4), gegen Open-Jam (2) - 100 bb, 6-max, NL2. + Postflop 16 Flops verschiedener Textur, je Flop/Turn/River; Linien: gegen Einsatz 1/3, 3/4, 1,5 Topf (BB gegen BTN), + angecheckt (BTN), eigener Einsatz erhöht (Flop/Turn), 3-Bet-Topf gegen Einsatz; je Handklasse + (lesen/poolruf_eichung.KLASSEN) bis zu 3 Kombos. + Gegner `ungelesen` (kein Profil) und `gelesen` (Profil wie im Owner-Fall 180165100008: ~25 Hände, Zähl-Read + raiseToBet n=1 k=0, der Live-Zustand der meisten Gegner). + +Ein Arm ist der Live-Stand (`betrieb/kern_schalter.txt`) mit Änderungen: `-K` nimmt K heraus, `K=V` setzt K. +Ohne Angabe läuft für JEDEN Live-Schalter der Arm `-K` (was bewirkt dieser Schalter heute?). +Gekippt = andere Aktionsart (Fold/Check/Call/Raise); nur eine andere Raise-Größe zählt als `groesse`. + +HARTER BEFUND: eine Prämienhand, die MIT dem Schalter foldet und ohne ihn weiterspielt. + Prämie vorflop: AK, AQ, AJ, KQ (suited und offsuit), Paare ab TT. Prämie postflop: Top-Paar oder besser. +Bei `-K` (Live-Schalter) ist "mit" = Live; bei `K=V` (Kandidat) ist "mit" = der Arm. + + python3 werkzeuge/kippliste.py --aus [--arm "-POSTERIOR"] [--arm "VORFLOP_POP=dreibet,iso,vs3bet"] + [--kern ] [--prozesse 6] [--nur vorflop|postflop] [--schalter ] + +Ausgabe: /kipp-.json (alle Kipps), /KIPPLISTE.md (Übersicht, harte Befunde zuerst). +Der Kern läuft als Kopie `pokerbench-pruefstand-kipp.exe` in Priorität Idle. +""" +import argparse +import collections +import hashlib +import concurrent.futures +import json +import os +import random +import shutil +import subprocess +import sys + +_HIER = os.path.dirname(os.path.abspath(__file__)) +BAUM = os.path.dirname(_HIER) +sys.path.insert(0, os.path.join(BAUM, "lesen")) +import poolruf_eichung as pe # noqa: E402 + +BB = 0.02 +STACK = 2.00 +RAENGE = "AKQJT98765432" +FARBEN = "shdc" +RANG = {"A": "ACE", "K": "KING", "Q": "QUEEN", "J": "JACK", "T": "TEN", "9": "NINE", "8": "EIGHT", + "7": "SEVEN", "6": "SIX", "5": "FIVE", "4": "FOUR", "3": "THREE", "2": "TWO"} +FARBE = {"s": "SPADES", "h": "HEARTS", "d": "DIAMONDS", "c": "CLUBS"} +POS = {1: "SB", 2: "BB", 3: "UTG", 4: "HJ", 5: "CO", 6: "BTN"} +# Live-Schalter, die nur Pfade für andere sind oder nicht im Kern wirken. +NICHT_EINZELN = {"TISCHWAHL", "GRUNDSTRATEGIE"} +PRAEMIE_VORFLOP = {"AKs", "AKo", "AQs", "AQo", "AJs", "AJo", "KQs", "KQo", "AA", "KK", "QQ", "JJ", "TT"} +AB_KLASSE_PRAEMIE = 3 # top_paar +GELESEN = {"vpip": 0.33, "pfr": 0.22, "foldToBet": 0.6, "cbet": 0.7, "foldToCbet": 0.31, "threeBet": 0.09, + "foldToThreeBet": 0.48, "steal": 0.44, "checkRaise": 0.04, "wtsd": 0.32, "wsd": 0.55, "hands": 25, + "aggression": 0.33, "aggressionActions": 3, + "reads": {"raiseToBet": {"n": 1, "k": 0}, "flopBetOpen": {"n": 1, "k": 0}}} +FLOPS = ["Ks7d2c", "Ah8c3d", "Qs9s4h", "JhTd8c", "7c6c5d", "9h9d3s", "Kd Qd 2d", "As Kd 5c", "8s5h2d", "Tc9c2h", + "6h6c6d", "Ad Jh Tc", "4s3s2h", "QhJc4c", "Kh Kc 8d", "Js7s2s"] + + +def karte(c): + return {"rank": RANG[c[0]], "suit": FARBE[c[1]]} + + +def flop_karten(f): + f = f.replace(" ", "") + return [f[i:i + 2] for i in range(0, 6, 2)] + + +# --------------------------------------------------------------------------------------------- +# Vorflop +# --------------------------------------------------------------------------------------------- + +def klassen169(): + """[(name, karte1, karte2)] in fester Reihenfolge; suited in Herz, offsuit Herz/Pik, Paare Herz/Karo.""" + out = [] + for i, a in enumerate(RAENGE): + for j, b in enumerate(RAENGE): + if i == j: + out.append((a + a, a + "h", a + "d")) + elif i < j: + out.append((a + b + "s", a + "h", b + "h")) + out.append((a + b + "o", a + "h", b + "s")) + return out + + +def _blinds(): + return [{"street": "PREFLOP", "seat": 1, "action": "POST_SB", "amount": 0.01}, + {"street": "PREFLOP", "seat": 2, "action": "POST_BB", "amount": 0.02}] + + +def _reihe(von, bis): + """Sitze in Vorflop-Reihenfolge (3,4,5,6,1,2) strikt zwischen von und bis.""" + o = [3, 4, 5, 6, 1, 2] + i, j = o.index(von), o.index(bis) + return o[i + 1:j] if i < j else [] + + +def _vor(seat): + o = [3, 4, 5, 6, 1, 2] + return o[:o.index(seat)] + + +def vorflop_lagen(): + """[(lage, hero, history, beitrag je Sitz, letzter Einsatz, Spieler im Topf)].""" + lagen = [] + o = [3, 4, 5, 6, 1, 2] + # Open + for h in (3, 4, 5, 6, 1): + hist = _blinds() + [{"street": "PREFLOP", "seat": s, "action": "FOLD"} for s in _vor(h)] + lagen.append(("open %s" % POS[h], h, hist, {1: 0.01, 2: 0.02}, 0.02, {h, 1, 2} | set(o[o.index(h):]))) + # gegen Open / 3-Bet / 4-Bet + for oi, op in enumerate(o[:-1]): + for he in o[oi + 1:]: + open_to = 0.06 if op == 1 else 0.05 + hist = _blinds() + [{"street": "PREFLOP", "seat": s, "action": "FOLD"} for s in _vor(op)] + hist.append({"street": "PREFLOP", "seat": op, "action": "RAISE", "amount": open_to}) + zw = [{"street": "PREFLOP", "seat": s, "action": "FOLD"} for s in _reihe(op, he)] + b = {1: 0.01, 2: 0.02, op: open_to} + lagen.append(("vs open %s->%s" % (POS[op], POS[he]), he, hist + zw, dict(b), open_to, {op, he})) + # 3-Bet: he erhöht, op (Held) entscheidet + drei = 0.23 if he in (1, 2) else 0.15 + nach = [{"street": "PREFLOP", "seat": s, "action": "FOLD"} for s in o[o.index(he) + 1:] if s != op] + h3 = hist + zw + [{"street": "PREFLOP", "seat": he, "action": "RAISE", "amount": drei}] + nach + b3 = dict(b) + b3[he] = drei + lagen.append(("vs 3bet %s<-%s" % (POS[op], POS[he]), op, h3, b3, drei, {op, he})) + # 4-Bet: op erhöht erneut, he (Held) entscheidet + vier = round(drei * 2.3, 2) + h4 = h3 + [{"street": "PREFLOP", "seat": op, "action": "RAISE", "amount": vier}] + b4 = dict(b3) + b4[op] = vier + lagen.append(("vs 4bet %s<-%s" % (POS[he], POS[op]), he, h4, b4, vier, {op, he})) + # gegen Limp + for he in (5, 6, 1, 2): + hist = _blinds() + [{"street": "PREFLOP", "seat": 3, "action": "CALL", "amount": 0.02}] + hist += [{"street": "PREFLOP", "seat": s, "action": "FOLD"} for s in _reihe(3, he)] + lagen.append(("vs limp UTG->%s" % POS[he], he, hist, {1: 0.01, 2: 0.02, 3: 0.02}, 0.02, {3, he, 1, 2})) + # gegen Open-Jam + for he in (6, 2): + hist = _blinds() + [{"street": "PREFLOP", "seat": s, "action": "FOLD"} for s in (3, 4)] + hist.append({"street": "PREFLOP", "seat": 5, "action": "ALL_IN", "amount": STACK}) + hist += [{"street": "PREFLOP", "seat": s, "action": "FOLD"} for s in _reihe(5, he)] + lagen.append(("vs jam CO->%s" % POS[he], he, hist, {1: 0.01, 2: 0.02, 5: STACK}, STACK, {5, he})) + return lagen + + +def vorflop_spots(profil): + out = [] + for lage, he, hist, beitrag, hoch, drin in vorflop_lagen(): + gefoldet = {r["seat"] for r in hist if r["action"] == "FOLD"} + tc = round(hoch - beitrag.get(he, 0.0), 4) + pot = round(sum(beitrag.values()), 4) + mein = beitrag.get(he, 0.0) + for name, c1, c2 in klassen169(): + vil = [] + for s in range(1, 7): + if s == he: + continue + v = {"seat": s, "stack": round(STACK - beitrag.get(s, 0.0), 4), "folded": s in gefoldet} + if profil and not v["folded"]: + v["profile"] = json.loads(json.dumps(GELESEN)) + vil.append(v) + allin = hoch >= STACK - 1e-9 + legal = (["FOLD"] if tc > 0 else []) + (["CALL"] if tc > 0 else ["CHECK"]) + ([] if allin else ["RAISE"]) + req = {"variant": "NLHE", "bigBlind": BB, "seats": 6, "heroSeat": he, "buttonSeat": 6, + "heroCards": [karte(c1), karte(c2)], "street": "PREFLOP", "pot": pot, "toCall": min(tc, STACK - mein), + "heroStack": round(STACK - mein, 4), "legalActions": legal, "villains": vil, "history": hist, + "seed": int(hashlib.blake2b((lage + name).encode(), digest_size=4).hexdigest(), 16)} + if not allin: + req["minRaiseTo"] = round(min(hoch + max(hoch - 0.02, 0.02) if hoch > 0.02 else 0.04, STACK), 4) + req["maxRaiseTo"] = STACK + out.append({"id": "pre|%s|%s|%s" % (lage, name, "g" if profil else "u"), "art": "vorflop", "lage": lage, + "hand": name, "praemie": name in PRAEMIE_VORFLOP, "gegner": "gelesen" if profil else "ungelesen", + "req": req}) + return out + + +# --------------------------------------------------------------------------------------------- +# Postflop +# --------------------------------------------------------------------------------------------- + +def _deck(): + return [r + f for r in RAENGE for f in FARBEN] + + +def _laufkarten(flop, rng): + rest = [c for c in _deck() if c not in flop] + rng.shuffle(rest) + return rest[0], rest[1] + + +def _haende(brett, rng, je=3): + """Bis zu `je` Kombos je Handklasse auf `brett` (seeded).""" + rest = [c for c in _deck() if c not in brett] + alle = [(a, b) for i, a in enumerate(rest) for b in rest[i + 1:]] + rng.shuffle(alle) + je_kl = collections.defaultdict(list) + for a, b in alle: + k = pe.klasse([a, b], brett) + if len(je_kl[k]) < je: + je_kl[k].append((a, b)) + return [(k, h) for k in sorted(je_kl) for h in je_kl[k]] + + +def _post_req(hero, villain, hist, brett, strasse, pot, tc, hstack, vstack, legal, min_to, seed, profil): + vil = [] + for s in range(1, 7): + if s == hero: + continue + v = {"seat": s, "stack": round(vstack if s == villain else STACK, 4), "folded": s != villain} + if profil and s == villain: + v["profile"] = json.loads(json.dumps(GELESEN)) + vil.append(v) + board = {"FLOP": [karte(c) for c in brett[:3]]} + if strasse >= 2: + board["TURN"] = [karte(brett[3])] + if strasse >= 3: + board["RIVER"] = [karte(brett[4])] + req = {"variant": "NLHE", "bigBlind": BB, "seats": 6, "heroSeat": hero, "buttonSeat": 6, "heroCards": None, + "board": board, "street": ("FLOP", "TURN", "RIVER")[strasse - 1], "pot": round(pot, 4), + "toCall": round(tc, 4), "heroStack": round(hstack, 4), "legalActions": legal, "villains": vil, + "history": hist, "seed": seed} + if "RAISE" in legal: + req["minRaiseTo"] = round(min(min_to, hstack), 4) # kurzer Stack: All-in ist die einzige Erhöhung + req["maxRaiseTo"] = round(hstack, 4) + return req + + +def _preflop_srp(op=6, de=2, to=0.05): + hist = _blinds() + [{"street": "PREFLOP", "seat": s, "action": "FOLD"} for s in (3, 4, 5)] + hist.append({"street": "PREFLOP", "seat": op, "action": "RAISE", "amount": to}) + hist.append({"street": "PREFLOP", "seat": 1, "action": "FOLD"}) + hist.append({"street": "PREFLOP", "seat": de, "action": "CALL", "amount": to}) + return hist, 2 * to + 0.01 + + +def _preflop_3bet(): + hist = _blinds() + [{"street": "PREFLOP", "seat": s, "action": "FOLD"} for s in (3, 4, 5)] + hist += [{"street": "PREFLOP", "seat": 6, "action": "RAISE", "amount": 0.05}, + {"street": "PREFLOP", "seat": 1, "action": "RAISE", "amount": 0.23}, + {"street": "PREFLOP", "seat": 2, "action": "FOLD"}, + {"street": "PREFLOP", "seat": 6, "action": "CALL", "amount": 0.23}] + return hist, 0.46 + 0.02 + + +STR = {1: "FLOP", 2: "TURN", 3: "RIVER"} + + +def postflop_linien(brett): + """[(linie, strasse, hero, villain, history, pot, toCall, hstack, vstack, legal, minRaiseTo)]. + Frühere Straßen: BB check, BTN setzt 1/2 Topf, BB callt (SRP) bzw. SB setzt 1/2, BTN callt (3-Bet-Topf).""" + out = [] + for strasse in (1, 2, 3): + # SRP BTN (6) gegen BB (2) + hist, pot = _preflop_srp() + drin = 0.05 + for s in range(1, strasse): + e = round(pot / 2, 4) + hist = hist + [{"street": STR[s], "seat": 2, "action": "CHECK"}, + {"street": STR[s], "seat": 6, "action": "BET", "amount": e}, + {"street": STR[s], "seat": 2, "action": "CALL", "amount": e}] + pot += 2 * e + drin += e + st = STACK - drin + # BB gegen Einsatz + for f in (0.33, 0.75, 1.5): + e = round(min(pot * f, st), 4) + h = hist + [{"street": STR[strasse], "seat": 2, "action": "CHECK"}, + {"street": STR[strasse], "seat": 6, "action": "BET", "amount": e}] + legal = ["FOLD", "CALL"] + (["RAISE"] if e < st else []) + out.append(("srp BB vs bet %.2f" % f, strasse, 2, 6, h, pot + e, e, st, st - e, legal, 2 * e)) + # BTN angecheckt + h = hist + [{"street": STR[strasse], "seat": 2, "action": "CHECK"}] + out.append(("srp BTN checked to", strasse, 6, 2, h, pot, 0.0, st, st, ["CHECK", "RAISE"], BB)) + # BTN setzt 1/2, BB erhöht auf 3x + if strasse <= 2: + e = round(pot / 2, 4) + r = round(3 * e, 4) + h = hist + [{"street": STR[strasse], "seat": 2, "action": "CHECK"}, + {"street": STR[strasse], "seat": 6, "action": "BET", "amount": e}, + {"street": STR[strasse], "seat": 2, "action": "RAISE", "amount": r}] + out.append(("srp BTN bet, BB raise 3x", strasse, 6, 2, h, pot + e + r, r - e, st - e, st - r, + ["FOLD", "CALL", "RAISE"], r + (r - e))) + # 3-Bet-Topf: SB (1) gegen BTN (6), Held BTN gegen Einsatz 1/2 + hist3, pot3 = _preflop_3bet() + drin3 = 0.23 + for s in range(1, strasse): + e = round(pot3 / 2, 4) + hist3 = hist3 + [{"street": STR[s], "seat": 1, "action": "BET", "amount": e}, + {"street": STR[s], "seat": 6, "action": "CALL", "amount": e}] + pot3 += 2 * e + drin3 += e + st3 = STACK - drin3 + e = round(min(pot3 * 0.5, st3), 4) + h = hist3 + [{"street": STR[strasse], "seat": 1, "action": "BET", "amount": e}] + legal = ["FOLD", "CALL"] + (["RAISE"] if e < st3 else []) + out.append(("3bp BTN vs bet 0.50", strasse, 6, 1, h, pot3 + e, e, st3, st3 - e, legal, 2 * e)) + return out + + +def postflop_spots(profil, je=3): + out = [] + for fi, f in enumerate(FLOPS): + rng = random.Random(1000 + fi) + flop = flop_karten(f) + t, r = _laufkarten(flop, rng) + brett5 = flop + [t, r] + for linie, strasse, hero, vil, hist, pot, tc, hst, vst, legal, min_to in postflop_linien(brett5): + brett = brett5[:(0, 3, 4, 5)[strasse]] + for k, (a, b) in _haende(brett, random.Random(int(hashlib.blake2b(("%d|%s|%d" % (fi, linie, strasse)).encode(), digest_size=2).hexdigest(), 16)), je): + seed = int(hashlib.blake2b(("%s|%s|%d|%s%s" % (f, linie, strasse, a, b)).encode(), digest_size=4).hexdigest(), 16) + req = _post_req(hero, vil, hist, brett5, strasse, pot, tc, hst, vst, legal, min_to, seed, profil) + req["heroCards"] = [karte(a), karte(b)] + out.append({"id": "post|%s|%s|%s|%s%s|%s" % (f.replace(" ", ""), STR[strasse], linie, a, b, "g" if profil else "u"), + "art": "postflop", "lage": "%s %s" % (STR[strasse], linie), "brett": "".join(brett), + "hand": a + b, "klasse": pe.KLASSEN[k], "praemie": k >= AB_KLASSE_PRAEMIE, + "gegner": "gelesen" if profil else "ungelesen", "req": req}) + return out + + +# --------------------------------------------------------------------------------------------- +# Kern +# --------------------------------------------------------------------------------------------- + +def lies_schalter(pfad): + s = {} + for z in open(pfad, encoding="utf-8"): + z = z.strip() + if not z or z.startswith("#") or "=" not in z: + continue + k, v = z.split("=", 1) + s[k.strip()] = v.strip() + return s + + +def arm_env(live, arm): + """`-K` nimmt K heraus (mit -GEGNER_LINIEN auch die Linien), `K=V` setzt K, mehrere mit `;`.""" + env = dict(live) + for teil in (arm or "").split(";"): + teil = teil.strip() + if not teil: + continue + if teil.startswith("-"): + env.pop(teil[1:], None) + elif "=" in teil: + k, v = teil.split("=", 1) + env[k] = v + return env + + +def kern_lauf(kern, spots, env_kern, prozesse=6, block=800): + """Antworten (Liste von dict) je Spot; Kern-Kopien in Priorität Idle, `prozesse` gleichzeitig.""" + env = {k: v for k, v in os.environ.items() if k not in env_kern} + env.update(env_kern) + stuecke = [spots[i:i + block] for i in range(0, len(spots), block)] + flags = 0x40 if sys.platform == "win32" else 0 + + def eins(stueck): + data = "".join(json.dumps(s["req"], ensure_ascii=True) + "\n" for s in stueck).encode("ascii") + pr = subprocess.Popen([kern], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, + env=env, creationflags=flags) + out, _ = pr.communicate(data) + return [json.loads(z) if z.strip() else {} for z in out.decode("utf-8").split("\n")[:len(stueck)]] + + with concurrent.futures.ThreadPoolExecutor(max_workers=prozesse) as ex: + ergebnisse = list(ex.map(eins, stuecke)) + return [a for e in ergebnisse for a in e] + + +def art(antwort, req=None): + """Was der Läufer spielt: eine Enthaltung wird CHECK, wenn nichts zu zahlen ist, sonst FOLD + (betrieb/runner.py::nie_verstreichen).""" + a = str(antwort.get("action") or "").upper() + if a in ("ABSTAIN", "") and req is not None and float(req.get("toCall") or 0) <= 0: + return "CHECK" + return "FOLD" if a in ("FOLD", "ABSTAIN", "") else a + + +def ist_fold(a): + return a == "FOLD" + + +def vergleich(spots, basis, arm, mit_ist_arm): + """Kipps zwischen Basis (Live) und Arm. `mit_ist_arm`: der Schalter ist im Arm an (Kandidat), sonst in der Basis.""" + kipps = [] + for s, a, b in zip(spots, basis, arm): + x, y = art(a, s["req"]), art(b, s["req"]) + if x == y: + if x == "RAISE" and abs(float(a.get("size") or 0) - float(b.get("size") or 0)) > 1e-6: + kipps.append({"id": s["id"], "typ": "groesse", "live": x, "arm": y}) + continue + mit, ohne = (b, a) if mit_ist_arm else (a, b) + hart = s["praemie"] and ist_fold(art(mit, s["req"])) and not ist_fold(art(ohne, s["req"])) + kipps.append({"id": s["id"], "typ": "art", "live": x, "arm": y, "hart": hart, "art_spot": s["art"], + "lage": s["lage"], "hand": s["hand"], "klasse": s.get("klasse"), "gegner": s["gegner"], + "praemie": s["praemie"], "grund_live": a.get("reason", ""), "grund_arm": b.get("reason", "")}) + return kipps + + +def zusammenfassung(arm, kipps, n_spots): + k = [x for x in kipps if x["typ"] == "art"] + hart = [x for x in k if x.get("hart")] + richt = collections.Counter("%s->%s" % (x["live"], x["arm"]) for x in k) + kl = collections.Counter(x["klasse"] or ("praemie" if x["praemie"] else "rest") for x in k) + lagen = collections.Counter(x["lage"].split(" ")[0] + " " + " ".join(x["lage"].split(" ")[1:3]) for x in k) + return {"arm": arm, "spots": n_spots, "gekippt": len(k), "groesse": len(kipps) - len(k), "hart": len(hart), + "richtung": dict(richt.most_common()), "klassen": dict(kl.most_common()), "lagen": dict(lagen.most_common(12)), + "harte_beispiele": hart[:40]} + + +def bericht(aus, zus): + z = ["# Kipp-Liste je Schalter", "", + "Erzeugt von `werkzeuge/kippliste.py`. Gekippt = andere Aktionsart als der Live-Stand.", + "Hart = eine Prämienhand (vorflop AK/AQ/AJ/KQ, TT+; postflop Top-Paar+) foldet MIT dem Schalter und spielt ohne ihn weiter.", + "", "| Arm | Spots | gekippt | nur Größe | hart | häufigste Richtungen |", "|---|---|---|---|---|---|"] + for s in sorted(zus, key=lambda s: (-s["hart"], -s["gekippt"])): + r = ", ".join("%s %d" % (k, v) for k, v in list(s["richtung"].items())[:3]) + z.append("| `%s` | %d | %d | %d | **%d** | %s |" % (s["arm"], s["spots"], s["gekippt"], s["groesse"], s["hart"], r)) + z.append("") + for s in sorted(zus, key=lambda s: -s["hart"]): + if not s["hart"]: + continue + z += ["## Harte Befunde: `%s`" % s["arm"], ""] + for x in s["harte_beispiele"][:15]: + z.append("- %s, %s %s (%s): live %s, Arm %s" % (x["lage"], x["hand"], x.get("klasse") or "", x["gegner"], x["live"], x["arm"])) + z.append(" - live: %s" % x["grund_live"][:220]) + z.append(" - Arm: %s" % x["grund_arm"][:220]) + z.append("") + open(os.path.join(aus, "KIPPLISTE.md"), "w", encoding="utf-8", newline="\n").write("\n".join(z) + "\n") + + +def kern_kopie(quelle, aus): + ziel = os.path.join(aus, "pokerbench-pruefstand-kipp.exe") + if not os.path.exists(ziel) or os.path.getmtime(ziel) < os.path.getmtime(quelle): + shutil.copy2(quelle, ziel) + return ziel + + +def spots_bauen(nur=None): + s = [] + if nur in (None, "vorflop"): + s += vorflop_spots(False) + vorflop_spots(True) + if nur in (None, "postflop"): + s += postflop_spots(False) + postflop_spots(True) + return s + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--aus", required=True) + ap.add_argument("--arm", action="append", default=[]) + ap.add_argument("--kern", default=os.path.join(BAUM, "target", "release", "rechner.exe")) + ap.add_argument("--schalter", default=os.path.join(BAUM, "betrieb", "kern_schalter.txt")) + ap.add_argument("--prozesse", type=int, default=6) + ap.add_argument("--nur", choices=("vorflop", "postflop")) + a = ap.parse_args() + os.makedirs(a.aus, exist_ok=True) + live = lies_schalter(a.schalter) + live.pop("TISCHWAHL", None) + arme = a.arm or ["-" + k for k in live if k not in NICHT_EINZELN] + kern = kern_kopie(a.kern, a.aus) + spots = spots_bauen(a.nur) + print("%d Spots, %d Arme" % (len(spots), len(arme)), flush=True) + basis_pfad = os.path.join(a.aus, "basis.jsonl") + basis = kern_lauf(kern, spots, live, a.prozesse) + with open(basis_pfad, "w", encoding="utf-8", newline="\n") as f: + for s, b in zip(spots, basis): + f.write(json.dumps({"id": s["id"], "a": b.get("action"), "size": b.get("size"), "reason": b.get("reason")}) + "\n") + alle = [] + alt = os.path.join(a.aus, "zusammenfassung.json") + if os.path.exists(alt): + alle = [z for z in json.load(open(alt, encoding="utf-8")) if z["arm"] not in arme] + for arm in arme: + env = arm_env(live, arm) + antw = kern_lauf(kern, spots, env, a.prozesse) + mit_ist_arm = not arm.strip().startswith("-") + kipps = vergleich(spots, basis, antw, mit_ist_arm) + name = arm.replace("=", "_").replace(",", "+").replace(":", "").replace("\\", "").replace("/", "")[:60] + json.dump(kipps, open(os.path.join(a.aus, "kipp-%s.json" % name), "w", encoding="utf-8"), ensure_ascii=False) + z = zusammenfassung(arm, kipps, len(spots)) + alle.append(z) + print("%-40s gekippt %5d hart %3d" % (arm, z["gekippt"], z["hart"]), flush=True) + json.dump(alle, open(alt, "w", encoding="utf-8"), ensure_ascii=False, indent=1) + bericht(a.aus, alle) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/werkzeuge/livefaelle.py b/werkzeuge/livefaelle.py index d6446508..54ab2677 100644 --- a/werkzeuge/livefaelle.py +++ b/werkzeuge/livefaelle.py @@ -201,10 +201,23 @@ def anhaengen(pfad, neue): # ---------------------------------------------------------------- Kandidat +def _teile(text): + """Trennt an ';' und an ',' - ein Komma trennt aber nur, wenn danach ein neues 'K=' folgt; sonst gehört es zum + Wert ('POSTERIOR=bluff,schutz,beleg', 'UEBERWERT=0.9,2' bleiben ganz; bis 18.11. wurden sie hier abgeschnitten).""" + out = [] + for stueck in (text or "").split(";"): + for t in stueck.split(","): + if "=" in t or not out: + out.append(t) + else: + out[-1] += "," + t + return out + + def arm_lesen(text): """'K=V;K=V' -> {K: V}; 'K=' oder 'K=aus' -> {K: None} (Schalter heraus).""" aus = {} - for teil in (text or "").replace(",", ";").split(";"): + for teil in _teile(text): if "=" not in teil: continue k, v = (t.strip() for t in teil.split("=", 1)) diff --git a/werkzeuge/tor_echt.py b/werkzeuge/tor_echt.py new file mode 100644 index 00000000..e646ee4f --- /dev/null +++ b/werkzeuge/tor_echt.py @@ -0,0 +1,411 @@ +#!/usr/bin/env python3 +"""Tor auf echten NL2-Spots: EIN Urteil je Arm, Pflicht vor jedem Live-Schalten (Auftrag Prüfstand 18.11.). + +Ein Arm ist der Live-Stand (`betrieb/kern_schalter.txt`) mit Änderungen, z. B. "POSTERIOR=bluff,schutz,beleg,fluss" +oder "-POSTERIOR" (Schalter heraus) oder mehrere mit ';'. Geprüft wird, Kern-Kopien in Priorität Idle: + + 1 EV echt hhDealer CoinPoker NL2 (messung/grosse_calls: Caller-Sicht, Muck-IPW, Spieler-Holdout) - Dev und + Holdout je eine feste Stichprobe; Delta gegen Live in bb mit 95 %-Bootstrap über die Setzer. + Zusätzlich jede `--spots`-Datei im selben Format (z. B. die POSTERIOR-Spots dieses Prüfstands). + 2 Pflichtfälle werkzeuge/pflichtfaelle.py (harte Verlierer = Rückschritt gegen Live). + 3 Eigen-Replay alle eigenen Kern-Anfragen aus den Schatten-Logs des Live-Baums: Entscheidungen anders, davon + Prämienhände zum Fold (vorflop AK/AQ/AJ/KQ, TT+; postflop Top-Paar+), Pflichtregel der Familie A + (keine Klasse >= Zwei Paar foldet gegen < 55 % Topf). + 4 Kipp-Liste werkzeuge/kippliste.py auf dem Raster (169 Starthände je Lage, Postflop je Handklasse). + 5 LBR gepaartes S1-LBR (engine_lbr, dieselben Hände) auf `--lbr N` Händen je Arm; 0 = nur Status aus + `--lbr-datei` (Ergebnisdatei je Arm, `i wert` je Zeile). + +Urteil: + DURCHGEFALLEN EV Dev oder Holdout signifikant negativ; Pflichtfall-Rückschritt; harte Kipps (Prämie zum Fold); + Eigen-Replay bricht die Pflichtregel; LBR signifikant schlechter. + OFFEN kein Verlierer, aber kein Nachweis (EV-Intervall schließt 0 ein und kein Teil zeigt Wirkung) + oder ein Teil fehlt. + BESTANDEN sonst. + + python3 werkzeuge/tor_echt.py --arm "POSTERIOR=bluff,schutz,beleg,fluss" --aus messung/pruefstand/tor/ + [--kern target/release/rechner.exe] [--live-wurzel ] [--daten C:/Users/marcm/pokerfreak-grossecalls] + [--spots extra.jsonl ...] [--stichprobe 5] [--prozesse 6] [--lbr 40] [--ohne kipp,lbr,...] + +Rohdaten mit Namen liegen nie im Repo; ins Repo geht nur TOR.md/tor.json (Zähler, Hand-IDs, Karten). +""" +import argparse +import collections +import json +import os +import subprocess +import sys + +import numpy as np + +_HIER = os.path.dirname(os.path.abspath(__file__)) +BAUM = os.path.dirname(_HIER) +for _p in (_HIER, os.path.join(BAUM, "lesen"), os.path.join(BAUM, "messung", "grosse_calls"), + os.path.join(BAUM, "messung", "familie_a")): + sys.path.insert(0, _p) +import kippliste as KL # noqa: E402 + +LIVE_WURZEL = r"D:\Projects\pokerfreak\.claude\worktrees\engine-lecks-angreifen-de7b88" +DATEN = r"C:\Users\marcm\pokerfreak-grossecalls" +STARK = ("TwoPair", "Trips", "Set", "Straight", "Flush", "FullHouse", "Quads", "StraightFlush") +PRAEMIE_POST = ("top_paar", "overpair", "zwei_paar", "drilling", "monster") + + +def arm_aenderung(arm): + """'K=V;-K' -> {K: V, K2: None} (Komma bleibt im Wert).""" + import livefaelle + out = {} + for teil in (arm or "").split(";"): + teil = teil.strip() + if teil.startswith("-"): + out[teil[1:]] = None + elif teil: + out.update(livefaelle.arm_lesen(teil)) + return out + + +def env_mit(live, aend): + env = dict(live) + for k, v in aend.items(): + if v is None: + env.pop(k, None) + else: + env[k] = v + return env + + +def boot(mat, n=1000, seed=7): + mat = np.asarray(mat, dtype=float) + if len(mat) == 0: + return 0.0, 0.0, 0.0 + rng = np.random.default_rng(seed) + idx = rng.integers(0, len(mat), size=(n, len(mat))) + b = mat[idx].sum(1) + return float(mat.sum()), float(np.percentile(b, 2.5)), float(np.percentile(b, 97.5)) + + +# --- 1 EV auf echten Spots ---------------------------------------------------------------------- + +def spots_laden(pfad, jede=1, maximal=None): + out = [] + for i, z in enumerate(open(pfad, encoding="utf-8")): + if i % jede: + continue + out.append(json.loads(z)) + if maximal and len(out) >= maximal: + break + return out + + +def ev_teil(kern, spots, env_live, env_arm, prozesse): + import population as P + a = KL.kern_lauf(kern, spots, env_live, prozesse) + b = KL.kern_lauf(kern, spots, env_arm, prozesse) + je = collections.defaultdict(lambda: collections.defaultdict(float)) + anders = collections.Counter() + for sp, x, y in zip(spots, a, b): + d = sp["w"] * (P.ev_aktion(sp, y.get("action"), y.get("size")) - P.ev_aktion(sp, x.get("action"), x.get("size"))) + st = ("flop", "turn", "river")[sp["strasse"] - 1] + for f in ("alle", st): + je[f][sp["pid_o"]] += d + if str(x.get("action")).upper() != str(y.get("action")).upper(): + anders["%s %s->%s" % (st, x.get("action"), y.get("action"))] += 1 + erg = {"spots": len(spots), "anders": dict(anders.most_common()), "delta": {}} + for f, m in je.items(): + s, lo, hi = boot(list(m.values())) + erg["delta"][f] = [round(s, 1), round(lo, 1), round(hi, 1), len(m)] + return erg + + +# --- 2 Pflichtfälle ------------------------------------------------------------------------------- + +def pflicht(kern, arm_text, schalter): + import livefaelle + aend = arm_aenderung(arm_text) + text = ";".join("%s=%s" % (k, "aus" if v is None else v) for k, v in aend.items()) + r = subprocess.run([sys.executable, "-I", "-X", "utf8", os.path.join(_HIER, "pflichtfaelle.py"), "--arm", text, + "--kern", kern, "--schalter", schalter, "--json"], capture_output=True, text=True, + encoding="utf-8", creationflags=0x40 if sys.platform == "win32" else 0) + try: + j = json.loads(r.stdout) + except ValueError: + return {"fehler": (r.stderr or r.stdout)[-600:]} + del livefaelle + return {"bestanden": j["bestanden"], "verlierer": j["verlierer"], "n": j["n"], "live_soll": j["live_soll"], + "kandidat_soll": j["kandidat_soll"], "ziele_behoben": j["ziele_behoben"], "ziele": j["ziele"], + "verlierer_faelle": [{"hand": z["hand"], "street": z["street"], "live": z["live"], "kandidat": z["kandidat"], + "grund": (z.get("grund_kandidat") or "")[:200]} for z in j["zeilen"] if z["verlierer"]]} + + +# --- 3 Eigen-Replay ------------------------------------------------------------------------------- + +def eigene_anfragen(wurzel): + import roentgen + out, gesehen = [], set() + for e in roentgen.daten(wurzel)["schatten"]: + a = roentgen._als_dict(e.get("anfrage")) + if not isinstance(a, dict) or not a.get("legalActions") or not a.get("heroCards"): + continue + k = json.dumps(a, sort_keys=True) + if k in gesehen: + continue + gesehen.add(k) + out.append({"req": a, "zug": e.get("zug") or e.get("kurz") or ""}) + return out + + +def _karten(req): + r = {"ACE": "A", "KING": "K", "QUEEN": "Q", "JACK": "J", "TEN": "T", "NINE": "9", "EIGHT": "8", "SEVEN": "7", + "SIX": "6", "FIVE": "5", "FOUR": "4", "THREE": "3", "TWO": "2"} + f = {"SPADES": "s", "HEARTS": "h", "DIAMONDS": "d", "CLUBS": "c"} + hc = [r[c["rank"]] + f[c["suit"]] for c in req.get("heroCards") or []] + b = req.get("board") or {} + if isinstance(b, dict): + brett = [r[c["rank"]] + f[c["suit"]] for s in ("FLOP", "TURN", "RIVER") for c in b.get(s, [])] + else: + brett = [r[c["rank"]] + f[c["suit"]] for c in b] + return hc, brett + + +def praemie(req): + import poolruf_eichung as pe + hc, brett = _karten(req) + if len(hc) != 2: + return False, "" + if not brett: + a, b = sorted(hc, key=lambda c: "AKQJT98765432".index(c[0])) + name = a[0] + b[0] + ("" if a[0] == b[0] else ("s" if a[1] == b[1] else "o")) + return name in KL.PRAEMIE_VORFLOP, name + k = pe.KLASSEN[pe.klasse(hc, brett)] + return k in PRAEMIE_POST, k + + +def eigen_replay(kern, wurzel, env_live, env_arm, prozesse): + sp = eigene_anfragen(wurzel) + a = KL.kern_lauf(kern, sp, env_live, prozesse) + b = KL.kern_lauf(kern, sp, env_arm, prozesse) + anders, hart, regel = [], [], [] + richt = collections.Counter() + for s, x, y in zip(sp, a, b): + xa, ya = KL.art(x, s["req"]), KL.art(y, s["req"]) + if xa == ya: + continue + req = s["req"] + pr, kl = praemie(req) + st = req.get("street") + e = {"zug": s["zug"][:90], "street": st, "hand": "".join(_karten(req)[0]), "klasse": kl, "live": xa, "arm": ya, + "grund_arm": (y.get("reason") or "")[:240]} + anders.append(e) + richt["%s %s->%s" % (st, xa, ya)] += 1 + if pr and ya == "FOLD": + hart.append(e) + tc, pot = float(req.get("toCall") or 0), float(req.get("pot") or 0) + if st != "PREFLOP" and ya == "FOLD" and tc > 0 and tc / max(pot - tc, 1e-9) < 0.55 and (y.get("category") or x.get("category")) in STARK: + regel.append(e) + return {"anfragen": len(sp), "anders": len(anders), "richtung": dict(richt.most_common()), + "praemie_zum_fold": hart[:30], "n_praemie_zum_fold": len(hart), "pflichtregel_bruch": regel[:30], + "n_pflichtregel_bruch": len(regel), "beispiele": anders[:40]} + + +# --- 4 Kipp-Liste --------------------------------------------------------------------------------- + +def kipp(kern, live, aend, prozesse, aus): + spots = KL.spots_bauen() + env_arm = env_mit(live, aend) + a = KL.kern_lauf(kern, spots, live, prozesse) + b = KL.kern_lauf(kern, spots, env_arm, prozesse) + # Kandidat (setzt etwas): "mit" = Arm. Reine Herausnahme: "mit" = Live. + mit_ist_arm = any(v is not None for v in aend.values()) + kipps = KL.vergleich(spots, a, b, mit_ist_arm) + json.dump(kipps, open(os.path.join(aus, "kipp.json"), "w", encoding="utf-8"), ensure_ascii=False) + z = KL.zusammenfassung(";".join("%s=%s" % (k, v) for k, v in aend.items()), kipps, len(spots)) + z["mit_ist_arm"] = mit_ist_arm + return z + + +# --- 5 LBR ---------------------------------------------------------------------------------------- + +def lbr_lesen(pfad): + d = {} + if pfad and os.path.exists(pfad): + for z in open(pfad, encoding="utf-8"): + t = z.split() + if len(t) >= 2: + d[int(t[0])] = float(t[1]) + return d + + +def lbr(baum, live, env_arm, haende, aus, threads): + exe = os.path.join(baum, "target", "release", "engine_lbr.exe") + if not os.path.exists(exe): + return {"status": "engine_lbr fehlt (cargo build --release --bin engine_lbr -j 4)"} + import shutil + kopie = os.path.join(aus, "pokerbench-pruefstand-lbr.exe") + shutil.copy2(exe, kopie) + erg = {} + for name, env in (("live", live), ("arm", env_arm)): + datei = os.path.join(aus, "lbr-%s.txt" % name) + e = {k: v for k, v in os.environ.items() if k not in live and k not in env_arm} + e.update(env) + e["POKERBENCH_THREADS"] = str(threads) + subprocess.run([kopie, datei, str(haende)], env=e, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, + creationflags=0x40 if sys.platform == "win32" else 0) + erg[name] = lbr_lesen(datei) + gem = sorted(set(erg["live"]) & set(erg["arm"])) + d = [erg["arm"][i] - erg["live"][i] for i in gem] + gleich = all(abs(x) < 1e-9 for x in d) + s, lo, hi = boot([[x] for x in d]) if d else (0.0, 0.0, 0.0) + n = max(len(gem), 1) + return {"haende": len(gem), "bitgleich": gleich, "delta_bb100": round(100 * s / n, 2), + "ci_bb100": [round(100 * lo / n, 2), round(100 * hi / n, 2)], + "live_bb100": round(100 * sum(erg["live"][i] for i in gem) / n, 2)} + + +# --- Urteil --------------------------------------------------------------------------------------- + +def urteil(r): + gruende, offen = [], [] + for teil in ("dev", "holdout"): + e = r.get("ev", {}).get(teil) + if not e: + offen.append("EV %s fehlt" % teil) + continue + s, lo, hi, _ = e["delta"].get("alle", [0, 0, 0, 0]) + if hi < 0: + gruende.append("EV %s signifikant negativ (%+.0f bb [%+.0f, %+.0f])" % (teil, s, lo, hi)) + for name, e in r.get("ev_extra", {}).items(): + s, lo, hi, _ = e["delta"].get("alle", [0, 0, 0, 0]) + if hi < 0: + gruende.append("EV %s signifikant negativ (%+.0f bb)" % (name, s)) + p = r.get("pflicht") + if p is None or "fehler" in (p or {}): + offen.append("Pflichtfälle nicht gelaufen") + elif not p["bestanden"]: + gruende.append("Pflichtfälle: %d harte Verlierer" % p["verlierer"]) + e = r.get("replay") + if e is None: + offen.append("Eigen-Replay fehlt") + else: + if e["n_praemie_zum_fold"]: + offen.append("Eigen-Replay: %d Prämienhände zum Fold (einzeln ansehen)" % e["n_praemie_zum_fold"]) + if e["n_pflichtregel_bruch"]: + gruende.append("Eigen-Replay bricht die Pflichtregel (%d Folds >= Zwei Paar gegen < 55 %% Topf)" % e["n_pflichtregel_bruch"]) + k = r.get("kipp") + if k is None: + offen.append("Kipp-Liste fehlt") + elif k["hart"] and k.get("mit_ist_arm", True): + gruende.append("Kipp-Liste: %d Prämienhände kippen zum Fold" % k["hart"]) + elif k["hart"]: + offen.append("Kipp-Liste: der herausgenommene Schalter foldet live %d Prämienhände (Grund für das Herausnehmen, kein Verlierer)" % k["hart"]) + lb = r.get("lbr") + if not lb or "haende" not in lb or not lb["haende"]: + offen.append("LBR nicht gemessen") + elif not lb["bitgleich"] and lb["ci_bb100"][0] > 0: + gruende.append("LBR schlechter (%+.1f bb/100 [%+.1f, %+.1f], mehr ausbeutbar)" % (lb["delta_bb100"], *lb["ci_bb100"])) + if gruende: + return "DURCHGEFALLEN", gruende, offen + dev = r.get("ev", {}).get("dev", {}).get("delta", {}).get("alle") + extra_sig = any(e["delta"].get("alle", [0, 0, 0])[1] > 0 for e in r.get("ev_extra", {}).values()) + if offen or not ((dev and dev[1] > 0) or extra_sig): + return "OFFEN", gruende, offen + ([] if (dev and dev[1] > 0) or extra_sig else ["kein EV-Nachweis (Intervall schließt 0 ein)"]) + return "BESTANDEN", gruende, offen + + +def bericht(r, aus): + z = ["# Tor echt: `%s`" % r["arm"], "", "**Urteil: %s**" % r["urteil"], ""] + for g in r["gruende"]: + z.append("- Verlierer: " + g) + for g in r["offen"]: + z.append("- offen: " + g) + z += ["", "## 1 EV auf echten NL2-Spots (Caller-Sicht, bb, 95 %-Bootstrap über die Setzer)", "", + "| Teil | Spots | Δ alle | Flop | Turn | River | geänderte Aktionen |", "|---|---|---|---|---|---|---|"] + def zelle(d, f): + x = d["delta"].get(f) + return "%+.0f [%+.0f, %+.0f]" % tuple(x[:3]) if x else "–" + for name, d in list(r.get("ev", {}).items()) + list(r.get("ev_extra", {}).items()): + z.append("| %s | %d | %s | %s | %s | %s | %s |" % (name, d["spots"], zelle(d, "alle"), zelle(d, "flop"), zelle(d, "turn"), + zelle(d, "river"), ", ".join("%s %d" % kv for kv in list(d["anders"].items())[:4]))) + p = r.get("pflicht") or {} + z += ["", "## 2 Pflichtfälle", ""] + if "fehler" in p or not p: + z.append("nicht gelaufen: %s" % p.get("fehler", "")[:300]) + else: + z.append("%s: Soll Live %d/%d, Arm %d/%d, Ziele behoben %d/%d, harte Verlierer %d" % ( + "bestanden" if p["bestanden"] else "DURCHGEFALLEN", p["live_soll"], p["n"], p["kandidat_soll"], p["n"], + p["ziele_behoben"], p["ziele"], p["verlierer"])) + for v in p["verlierer_faelle"]: + z.append("- %s %s: live %s -> %s (%s)" % (v["hand"], v["street"], v["live"], v["kandidat"], v["grund"])) + e = r.get("replay") or {} + z += ["", "## 3 Eigen-Replay (eigene Kern-Anfragen aus den Schatten-Logs)", ""] + if e: + z.append("%d Anfragen, %d anders: %s" % (e["anfragen"], e["anders"], ", ".join("%s %d" % kv for kv in list(e["richtung"].items())[:8]))) + z.append("Prämie zum Fold: %d; Pflichtregel-Brüche: %d" % (e["n_praemie_zum_fold"], e["n_pflichtregel_bruch"])) + for x in e["praemie_zum_fold"][:10]: + z.append("- %s %s %s (%s): %s -> %s | %s" % (x["zug"][:40], x["street"], x["hand"], x["klasse"], x["live"], x["arm"], x["grund_arm"][-160:])) + k = r.get("kipp") or {} + z += ["", "## 4 Kipp-Liste (Raster: 169 Starthände je Lage, Postflop je Handklasse)", ""] + if k: + z.append("%d Spots, %d gekippt, %d nur Größe, **%d hart**; Richtungen: %s" % ( + k["spots"], k["gekippt"], k["groesse"], k["hart"], ", ".join("%s %d" % kv for kv in list(k["richtung"].items())[:6]))) + for x in k["harte_beispiele"][:12]: + z.append("- %s, %s (%s, %s): live %s, Arm %s | %s" % (x["lage"], x["hand"], x.get("klasse") or "", x["gegner"], x["live"], x["arm"], + (x["grund_arm"] if x["arm"] == "FOLD" else x["grund_live"])[-180:])) + lb = r.get("lbr") or {} + z += ["", "## 5 LBR (S1, gepaart)", "", json.dumps(lb, ensure_ascii=False)] + open(os.path.join(aus, "TOR.md"), "w", encoding="utf-8", newline="\n").write("\n".join(z) + "\n") + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--arm", required=True) + ap.add_argument("--aus", required=True) + ap.add_argument("--kern", default=os.path.join(BAUM, "target", "release", "rechner.exe")) + ap.add_argument("--schalter", default=os.path.join(BAUM, "betrieb", "kern_schalter.txt")) + ap.add_argument("--live-wurzel", default=LIVE_WURZEL) + ap.add_argument("--daten", default=DATEN) + ap.add_argument("--spots", action="append", default=[]) + ap.add_argument("--stichprobe", type=int, default=5, help="jede n-te Zeile aus spots2(.holdout).jsonl") + ap.add_argument("--prozesse", type=int, default=6) + ap.add_argument("--lbr", type=int, default=40) + ap.add_argument("--lbr-threads", type=int, default=4) + ap.add_argument("--ohne", default="", help="Komma-Liste: ev,pflicht,replay,kipp,lbr") + a = ap.parse_args() + ohne = set(x for x in a.ohne.split(",") if x) + os.makedirs(a.aus, exist_ok=True) + live = KL.lies_schalter(a.schalter) + live.pop("TISCHWAHL", None) + aend = arm_aenderung(a.arm) + env_arm = env_mit(live, aend) + kern = KL.kern_kopie(a.kern, a.aus) + r = {"arm": a.arm, "aenderung": aend} + if "ev" not in ohne: + r["ev"] = {} + for teil, datei in (("dev", "spots2.jsonl"), ("holdout", "spots2.holdout.jsonl")): + p = os.path.join(a.daten, datei) + if os.path.exists(p): + r["ev"][teil] = ev_teil(kern, spots_laden(p, a.stichprobe), live, env_arm, a.prozesse) + print("EV", teil, r["ev"][teil]["delta"].get("alle"), flush=True) + r["ev_extra"] = {} + for p in a.spots: + r["ev_extra"][os.path.basename(p)] = ev_teil(kern, spots_laden(p), live, env_arm, a.prozesse) + print("EV", p, r["ev_extra"][os.path.basename(p)]["delta"].get("alle"), flush=True) + if "pflicht" not in ohne: + r["pflicht"] = pflicht(a.kern, a.arm, a.schalter) + print("Pflicht", {k: v for k, v in r["pflicht"].items() if k != "verlierer_faelle"}, flush=True) + if "replay" not in ohne and os.path.isdir(a.live_wurzel): + r["replay"] = eigen_replay(kern, a.live_wurzel, live, env_arm, a.prozesse) + print("Replay", r["replay"]["anfragen"], r["replay"]["anders"], r["replay"]["n_praemie_zum_fold"], flush=True) + if "kipp" not in ohne: + r["kipp"] = kipp(kern, live, aend, a.prozesse, a.aus) + print("Kipp", r["kipp"]["gekippt"], r["kipp"]["hart"], flush=True) + if "lbr" not in ohne and a.lbr > 0: + r["lbr"] = lbr(BAUM, live, env_arm, a.lbr, a.aus, a.lbr_threads) + print("LBR", r["lbr"], flush=True) + r["urteil"], r["gruende"], r["offen"] = urteil(r) + json.dump(r, open(os.path.join(a.aus, "tor.json"), "w", encoding="utf-8", newline="\n"), ensure_ascii=False, indent=1) + bericht(r, a.aus) + print("URTEIL", r["urteil"], r["gruende"], r["offen"]) + return 0 if r["urteil"] == "BESTANDEN" else 1 + + +if __name__ == "__main__": + sys.exit(main())