diag_werte: Tabelle der Fluss-BA-Pruefflaelle

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 09:17:12 +01:00
co-authored by Claude Opus 5.5
parent 370f96f02e
commit 7f943ee7eb
+21
View File
@@ -0,0 +1,21 @@
"""Tabelle der Fluss-BA-Pruefflaelle: je Fall alter Zug, neuer Zug, Werte, m, pi.
python3 -I -X utf8 ba_tabelle.py <ba.jsonl>"""
import json, re, sys
n = gilt = wechsel = 0
for z in open(sys.argv[1], encoding="utf-8"):
r = json.loads(z)
n += 1
d = [x for x in r["diag"] if x["strasse"] == 3]
d = d[-1] if d else None
g = r["grund"]
m = re.search(r"\[Fluss BA (\S+) -> (\S+):.*?Quelle ([^;]+); Werte Loesung ([^ ]+) BA ([^\]]+)\]", g)
kopf = f"{r['hand']} {''.join(r['karten'])} zu {r['toCall_bb']}"
mp = f"m={d['gegner']['m']:.3g} pi={d['eigen']['pi']:.3g} q={d['q_hand']:.2f}/{d['q_gegner']:.2f}" if d else "ohne Suche"
if m:
gilt += 1
wechsel += m.group(1) != m.group(2)
print(f"{kopf} | {mp} | BA {m.group(1)} -> {m.group(2)} Quelle {m.group(3)} | Loesung {m.group(4)} | BA {m.group(5)}")
else:
print(f"{kopf} | {mp} | {r['aktion']} (Regel gilt nicht)")
print(f"{n} Faelle, Regel gilt {gilt}, Zug geaendert {wechsel}")