score: basis_antworten reads the engine's mixture labels ([Bet(z), share], z in hundredths of bb) and uses the solution mixture when the final move is the basis and no exploit acted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Marc Mintel
2026-12-05 23:54:27 +01:00
co-authored by Claude Opus 5.5
parent d6f8725893
commit 6d71f38a2a
@@ -9,10 +9,14 @@ sonst der eine Zug. art: 0 Fold, 1 Check/Call, 2 Einsatz/Erhoehung (Ziel in bb =
`vermischt` der Basis wird je Zeile mitgeschrieben (Auskunft; die Scorecard zaehlt die Zeilen mit offener Vermischung).
"""
import json
import re
import os
import sys
ART = {"FOLD": 0, "CHECK": 1, "CALL": 1, "BET": 2, "RAISE": 2, "ALL_IN": 2}
# Bezeichner der Mischung im Motor (Grundtext/`basis.mischung`): Fold, Check, Call, Bet(z), Raise(z), AllIn(z); z in Hundertstel-bb (Ziel des Einsatzes)
MARKE = re.compile(r"^(Fold|Check|Call|Bet|Raise|AllIn)(?:\((\d+(?:\.\d+)?)\))?$")
HUNDERTSTEL = 100.0
def zug(action, size, bb):
@@ -22,22 +26,44 @@ def zug(action, size, bb):
return [art, (float(size) / bb) if art == 2 and size is not None else 0.0]
def marke(text):
"""'Bet(1170)' -> [2, 11.7]; 'Check' -> [1, 0.0]; unbekannt -> ValueError."""
m = MARKE.match(text.strip())
if not m:
raise ValueError("unbekannter Zug in basis.mischung: %r" % text)
art = {"Fold": 0, "Check": 1, "Call": 1}.get(m.group(1), 2)
return [art, float(m.group(2)) / HUNDERTSTEL if art == 2 else 0.0]
def gleicher_zug(a, b):
return a.get("action") == b.get("action") and (a.get("size") is None) == (b.get("size") is None) and (a.get("size") is None or abs(a["size"] - b["size"]) < 1e-9)
def basis_antwort(antwort, anfrage):
"""Mischung der Basis: (1) `basis.mischung` (Liste [marke, anteil] oder {zug, anteil}), (2) sonst, wenn der Endzug die Basis ist und keine
Ausbeute eingriff (kein Feld `ausbeute`), die Mischung der Antwort (`werte`, dieselbe Loesung), (3) sonst der eine Basis-Zug."""
b = antwort.get("basis")
if not isinstance(b, dict):
raise ValueError("Antwort ohne Feld basis")
bb = float(anfrage["bigBlind"])
werte = []
werte, herkunft = [], "basis.zug"
for e in b.get("mischung") or []:
z = e.get("zug") or {}
w = zug(z.get("action"), z.get("size"), bb)
if w is not None and float(e.get("anteil", 0.0)) > 0.0:
werte.append(w + [float(e["anteil"])])
if isinstance(e, (list, tuple)):
w, anteil = marke(e[0]), float(e[1])
else:
z = e.get("zug") or {}
w, anteil = zug(z.get("action"), z.get("size"), bb), float(e.get("anteil", 0.0))
if w is not None and anteil > 0.0:
werte.append(w + [anteil])
herkunft = "basis.mischung"
if not werte and not antwort.get("ausbeute") and gleicher_zug(antwort, b) and antwort.get("werte"):
werte = [[w[0], w[1], w[2]] for w in antwort["werte"] if w[2] > 0.0]
herkunft = "werte (Endzug = Basis, ohne Ausbeute)"
if not werte:
w = zug(b.get("action"), b.get("size"), bb)
if w is not None:
werte.append(w + [1.0])
return {"action": b.get("action"), "size": b.get("size"), "werte": werte, "reason": "basis", "vermischt": b.get("vermischt")}
return {"action": b.get("action"), "size": b.get("size"), "werte": werte, "reason": "basis: " + herkunft, "vermischt": b.get("vermischt")}
def main(argv):
@@ -53,7 +79,9 @@ def main(argv):
f.write("\n".join(zeilen) + "\n")
os.replace(ziel + ".tmp", ziel)
offen = sum(1 for x in a if (x.get("basis") or {}).get("vermischt"))
print("%d Basis-Antworten -> %s (mit offener Vermischung: %d)" % (len(zeilen), ziel, offen))
from collections import Counter
herk = Counter(json.loads(z)["reason"] for z in zeilen)
print("%d Basis-Antworten -> %s (mit offener Vermischung: %d) | %s" % (len(zeilen), ziel, offen, ", ".join("%s %d" % kv for kv in herk.most_common())))
if __name__ == "__main__":