Motor-Konstanten: Zaehler, wie oft Nr. 6, 12, 13, 14, 22, 23, 25, 52/53 auf den 7.779 Tor-1-Anfragen greifen (nur Summen)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3daebc59f2
commit
eb9c87fe97
@@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Wie oft greifen die Motor-Konstanten Nr. 6, 12, 13, 14, 22, 23, 25, 52/53 (HEURISTIK-INVENTUR, Teil motor.md) auf den 7.779 Tor-1-Anfragen?
|
||||
Liest Anfragen und die Antworten der Fassung b263403f (Arm B), zaehlt nur Summen. Was nur im Motor sichtbar ist, ist als Obergrenze (Kandidat) gezaehlt.
|
||||
python3 messung/motor_konstanten/zaehlen.py <ein-tor1.jsonl> <aus-B-gesamt.jsonl>
|
||||
"""
|
||||
import collections, json, re, sys
|
||||
|
||||
POSTS = ("POST_SB", "POST_BB", "POST_ANTE", "POST_STRADDLE", "POST")
|
||||
|
||||
|
||||
def typ_probe(n, v): # allin_probe.rs typ_von_profil
|
||||
if n is None or v is None or n < 30: return 0
|
||||
return 1 if v < 0.22 else (2 if v < 0.45 else 3)
|
||||
|
||||
|
||||
def typ_vorflop(n, v): # vorflop_tafel.rs
|
||||
if n is None or v is None or n < 100: return 0
|
||||
return 1 if v < 0.30 else (2 if v <= 0.44 else 3)
|
||||
|
||||
|
||||
def main(ein, aus):
|
||||
c = collections.Counter()
|
||||
typ_paare = collections.Counter()
|
||||
for zq, za in zip(open(ein, encoding="utf-8"), open(aus, encoding="utf-8")):
|
||||
q, a = json.loads(zq), json.loads(za)
|
||||
a = a.get("antwort", a)
|
||||
g = a.get("reason") or ""
|
||||
st = q.get("street")
|
||||
hist = [h for h in q.get("history") or [] if h.get("action") not in POSTS]
|
||||
c["alle"] += 1
|
||||
# 6 ohne_limp: vorflop, erster im Topf, nicht SB/BB
|
||||
if st == "PREFLOP":
|
||||
vorher = [h for h in hist if h.get("street") == "PREFLOP"]
|
||||
blinds = {h["seat"] for h in q.get("history") or [] if h.get("action") in ("POST_SB", "POST_BB")}
|
||||
if not vorher and q.get("heroSeat") not in blinds:
|
||||
c["6 erster im Topf (nicht Blind)"] += 1
|
||||
m = re.search(r"call (\d+)%", g)
|
||||
if m and int(m.group(1)) > 0:
|
||||
c["6 ... Tafel zeigt Call > 0 % (Masse wird umgebucht)"] += 1
|
||||
# 12 All-in-Uebersetzung vorflop: echte Erhoehungen im Verlauf
|
||||
rs = [h for h in vorher if h.get("action") in ("RAISE", "BET", "ALL_IN")]
|
||||
if rs:
|
||||
c["12 vorflop mit echter Erhoehung im Verlauf"] += 1
|
||||
if any(h.get("action") == "ALL_IN" for h in rs):
|
||||
c["12 ... davon mit echtem All-in"] += 1
|
||||
if any(h.get("action") == "RAISE" and len([x for x in rs]) >= 2 for h in rs):
|
||||
c["12 ... 3-Bet oder mehr (dort mischt die Zuordnung mit dem All-in)"] += 1
|
||||
# 13 Abbildungsgrenze
|
||||
if "liegt weit ueber dem Baum" in g: c["13 Grund 'liegt weit ueber dem Baum'"] += 1
|
||||
if a.get("ausser_baum"): c["13 Feld ausser_baum"] += 1
|
||||
# 14 Aufrunden zum All-in, 22 0,97-Stack
|
||||
mx = q.get("maxRaiseTo") or 0
|
||||
if a.get("action") in ("RAISE", "BET") and a.get("size") and mx:
|
||||
r = a["size"] / mx
|
||||
if r >= 0.999:
|
||||
c["14 Raise auf maxRaiseTo (aufgerundet oder Menue-All-in)"] += 1
|
||||
if not re.search(r"all-in|AllIn", g.split(":")[-1] if ":" in g else g):
|
||||
pass
|
||||
if 0.97 <= r < 0.999: c["22 Raise mit 97-99,9 % des Stapels (zaehlt als All-in)"] += 1
|
||||
if 0.80 <= r < 0.97: c["22 Raise mit 80-97 % des Stapels (zaehlt nicht als All-in)"] += 1
|
||||
if a.get("action") == "ALL_IN": c["14/22 Aktion ALL_IN"] += 1
|
||||
# 23 Kappe 12 Toepfe, 25 Loeser-Parameter
|
||||
m = re.search(r"Topf (\d+) Rest (\d+)", g)
|
||||
if m:
|
||||
c["25 Antwort aus Loesung/Bibliothek (Baum mit add/force/merge-Schwellen)"] += 1
|
||||
topf, rest = int(m.group(1)), int(m.group(2))
|
||||
if topf and rest == 12 * topf: c["23 Rest genau 12 Toepfe (Kappe hat gegriffen)"] += 1
|
||||
if topf and rest >= 12 * topf: c["23 Rest >= 12 Toepfe"] += 1
|
||||
# 52/53 Typdefinitionen
|
||||
for v in q.get("villains") or []:
|
||||
if v.get("folded"): continue
|
||||
p = v.get("profile") or {}
|
||||
n, vp = p.get("hands"), p.get("vpip")
|
||||
tp, tv = typ_probe(n, vp), typ_vorflop(n, vp)
|
||||
c["52/53 lebende Gegner (Sitz x Anfrage)"] += 1
|
||||
if tp != tv:
|
||||
c["52/53 ... Typ nach Probe != Typ nach Vorflop-Tafel (Sitz x Anfrage)"] += 1
|
||||
typ_paare[(tp, tv)] += 1
|
||||
diff = True
|
||||
if any(typ_probe((v.get("profile") or {}).get("hands"), (v.get("profile") or {}).get("vpip")) != typ_vorflop((v.get("profile") or {}).get("hands"), (v.get("profile") or {}).get("vpip")) for v in q.get("villains") or [] if not v.get("folded")):
|
||||
c["52/53 Anfragen mit mind. einem Gegner, dessen Typ je nach Definition anders ist"] += 1
|
||||
if st == "PREFLOP" and ("Jam" in g or "jam" in g or "Probe" in g):
|
||||
c["52/53 ... davon mit Jam-/Probe-Marke im Grund"] += 1
|
||||
n = c["alle"]
|
||||
for k, v in sorted(c.items()):
|
||||
print(f"{v:6d} {100 * v / n:6.2f} % {k}")
|
||||
print("Typ-Paare (Probe, Vorflop-Tafel; 0 unbekannt, 1 eng, 2 mittel, 3 locker):", dict(typ_paare.most_common()))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1], sys.argv[2])
|
||||
Reference in New Issue
Block a user