Regeln fuer River, Flop/Turn, Einsaetze und Iso gegen Limper (nl2.rs), Tafeln ohne Spielerkennungen. Gemeinsam gegen den Trainer-Pool: +8,0 +-3,9 bb/100 mit bekanntem Typ, +0,9 +-6,6 ohne. Gewinn live nicht belegt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.1 KiB
Python
54 lines
2.1 KiB
Python
"""Fragt den Motor an allen eigenen Punkten alter Slumbot-Haende: Absturz, Notfall-Quote, Zeit, Haeufigkeiten."""
|
|
import collections
|
|
import glob
|
|
import json
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
|
|
import slumbot as S
|
|
|
|
n = int(sys.argv[1])
|
|
kern = S.Kern(sys.argv[2], None) if len(sys.argv) == 3 else None
|
|
if kern is None:
|
|
kern = S.Kern.__new__(S.Kern)
|
|
kern.p = subprocess.Popen(sys.argv[2:], stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True, encoding="utf-8", bufsize=1)
|
|
zeit, art, notfall, zeigen = collections.defaultdict(list), collections.Counter(), collections.Counter(), 0
|
|
haende = 0
|
|
for f in glob.glob("slumbot/haende-*.jsonl"):
|
|
for z in open(f, encoding="utf-8"):
|
|
if haende >= n:
|
|
break
|
|
h = json.loads(z)
|
|
haende += 1
|
|
ich = 0 if h["pos"] == 1 else 1
|
|
teile = re.findall(r"b\d+|[kcf/]", h["aktion"])
|
|
for i in range(len(teile) + 0):
|
|
if teile[i] == "/":
|
|
continue
|
|
vor = "".join(teile[:i])
|
|
x = S.zerlege(vor)
|
|
if x["dran"] != ich:
|
|
continue
|
|
brett = h["brett"][: [0, 3, 4, 5][x["st"]]]
|
|
a, r = S.anfrage(x, h["pos"], h["loch"], brett, 0.02, 1234)
|
|
t = time.time()
|
|
w = kern.frage(a)
|
|
zeit[a["street"]].append(time.time() - t)
|
|
incr, verm = S.zug_aus(w, r)
|
|
art[(a["street"], "gegen" if r["zu_zahlen"] else "frei", w["action"])] += 1
|
|
if "notfall" in w["reason"] or "nicht genau" in w["reason"] or verm:
|
|
notfall[re.sub(r"[\d.]+", "#", w["reason"])[:110] + " " + str(verm)] += 1
|
|
elif a["street"] in ("TURN", "RIVER") and zeigen < 12:
|
|
zeigen += 1
|
|
print(h["loch"], brett, vor, "->", w["action"], w["size"], w["reason"])
|
|
for k, v in zeit.items():
|
|
v.sort()
|
|
print(k, len(v), "Median %.2f s, 95%% %.2f s, max %.2f s" % (v[len(v) // 2], v[int(len(v) * .95)], v[-1]))
|
|
for k, v in sorted(art.items()):
|
|
print(k, v)
|
|
print("Notfall/Vermerk:")
|
|
for k, v in notfall.most_common(20):
|
|
print(v, k)
|