score_schnell: --stand appends one line per run to a fixed Markdown stand file (headline, pool, robustness, per opponent, all-in count)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Marc Mintel
2026-12-05 19:01:25 +01:00
co-authored by Claude Opus 5.5
parent 5c56b0b9a3
commit 947cb12f5b
@@ -12,6 +12,8 @@ Score_o = 100 * Summe(EV_F - EV_CS) / Summe(EV_BR - EV_CS) (100 = beste Antwort
Ausgabe: <aus>/score-<name>.json und eine Textzeile (Schlagzeile: schlechtester Gegner). Antworten: <aus>/antworten-<name>.jsonl.
"""
import argparse
import datetime
import hashlib
import json
import os
import subprocess
@@ -46,6 +48,7 @@ def main():
ap.add_argument("--werkzeug", required=True, help="Motor-Exe mit richter-lock-wert --score (claude/score-lock)")
ap.add_argument("--ohne-frist", action="store_true")
ap.add_argument("--teile", type=int, default=1)
ap.add_argument("--stand", help="feste Stand-Datei (Markdown), je Lauf eine Zeile angehaengt")
ap.add_argument("--fraglich", default="echt-019,sim-3-025", help="Spots mit fraglicher Gegner-Range (in der Auswertung auch ohne sie)")
a = ap.parse_args()
os.makedirs(a.aus, exist_ok=True)
@@ -67,6 +70,33 @@ def main():
argv = [sys.executable, os.path.join(HIER, "score_auswertung.py"), je_spot, RICHTER + "/spots/spots.jsonl", "--fraglich", a.fraglich,
"--modell", antw.DATEN + "/gedaechtnis2/modell.json", "--aus", os.path.join(a.aus, "auswertung-%s.json" % a.name)]
subprocess.run(argv, check=True)
if a.stand:
stand_zeile(a.stand, a.name, a.exe, e, json.load(open(os.path.join(a.aus, "auswertung-%s.json" % a.name)))[a.name])
def sha_kurz(pfad):
try:
with open(pfad, "rb") as f:
return hashlib.sha256(f.read()).hexdigest()[:8].upper()
except OSError:
return "-"
def stand_zeile(pfad, name, exe, e, aus):
"""Eine Zeile je Lauf an die feste Stand-Datei anhaengen (Kopf beim ersten Mal); nie ueberschreiben."""
kopf = ("# Scorecard-Stand (score_schnell.py)\n\n100 = beste Antwort auf den Gegner, 0 = Calling-Station. Schlagzeile = schlechtester Gegner; Pool = Typen nach Anteil.\n\n"
"| Zeit | Fassung | Exe | Schlagzeile | Pool | ohne 3 teuerste | je Gegner | All-ins > 5 bb |\n|---|---|---|---|---|---|---|---|\n")
iv = e.get("laborwert_intervall") or [float("nan")] * 2
alle = aus["alle"]
piv = alle.get("pool_intervall") or [float("nan")] * 2
je = " ".join("%s %.0f" % (kurz(g["gegner"]), g["score"]) for g in e["je_gegner"] if g["score"] is not None)
zeile = "| %s | %s | %s | %.0f [%.0f; %.0f] %s | %s | %s | %s | %d |\n" % (
datetime.datetime.now().strftime("%d.%m. %H:%M"), name, sha_kurz(exe), e["laborwert"], iv[0], iv[1], kurz(e["schlechtester"]),
"%.0f [%.0f; %.0f]" % (alle["pool"], piv[0], piv[1]) if alle.get("pool") is not None else "-",
"%.0f" % aus["ohne_3_teuerste"]["laborwert"] if aus["ohne_3_teuerste"]["laborwert"] is not None else "-", je, len(aus["allin_liste"]))
neu = not os.path.exists(pfad)
with open(pfad, "a") as f:
f.write((kopf if neu else "") + zeile)
if __name__ == "__main__":