From 947cb12f5b1885b61dec297e69977a5ecbac22df Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Sat, 5 Dec 2026 19:01:25 +0100 Subject: [PATCH] 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 --- .../motor/richter_lock/score_schnell.py | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/entscheiden/motor/richter_lock/score_schnell.py b/entscheiden/motor/richter_lock/score_schnell.py index 91c53cca..5fb8a496 100644 --- a/entscheiden/motor/richter_lock/score_schnell.py +++ b/entscheiden/motor/richter_lock/score_schnell.py @@ -12,6 +12,8 @@ Score_o = 100 * Summe(EV_F - EV_CS) / Summe(EV_BR - EV_CS) (100 = beste Antwort Ausgabe: /score-.json und eine Textzeile (Schlagzeile: schlechtester Gegner). Antworten: /antworten-.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__":