57 lines
3.4 KiB
Python
57 lines
3.4 KiB
Python
"""Grobe Pruefung MOTOR_HYB_FLOP_MAX=1.0: echte Flop-Anfragen seit dem Hybrid durch die neue Exe, Live-Schalter mit und ohne
|
|
den Deckel; dazu die Aus-Pruefung gegen die Live-Exe. Nur bei ausgeschaltetem Laeufer (fragt die Live-SHARINGAN-Dienste).
|
|
Schreibt ergebnis.jsonl (nur anhaengen)."""
|
|
import json, os, subprocess, collections, random
|
|
LIVE = "D:/Projects/pokerfreak/.claude/worktrees/engine-lecks-angreifen-de7b88"
|
|
HIER = os.path.dirname(os.path.abspath(__file__))
|
|
EXE = os.path.join(HIER, "pokerbench-motor-flopmax.exe")
|
|
BASIS = "D:/Projects/pokerfreak/entscheiden/motor/target/pokerbench-motor-schatten.exe"
|
|
d = "D:/Projects/pokerfreak/daten/grundstrategie/motor"
|
|
ARGS = ["dienst", "sechs100", d, "2000-600-400", "200", d + "/sechs100-v2.bin", "genau", f"hu={d}/hu100-v1.bin,{d}/hu200-v2.bin"]
|
|
umg = {}
|
|
for z in open(LIVE + "/betrieb/kern_schalter.txt", encoding="utf-8"):
|
|
z = z.strip()
|
|
if z and not z.startswith("#") and "=" in z:
|
|
k, v = z.split("=", 1)
|
|
if k.startswith("MOTOR_") and v: umg[k] = v
|
|
vor, nach = [], []
|
|
with open(LIVE + "/archiv/lauf/schatten.jsonl", "rb") as f:
|
|
for l in f:
|
|
if b'"q"' not in l: continue
|
|
try: r = json.loads(l)
|
|
except Exception: continue
|
|
if str(r.get("zeit", "")) < "2026-11-30T00:24": continue
|
|
q = r["q"]
|
|
if q.get("street") != "FLOP": continue
|
|
if "sharingan search" in str((r.get("motor") or {}).get("reason")): vor.append(r)
|
|
else: nach.append(r)
|
|
random.seed(7); vor = random.sample(vor, min(400, len(vor))); nach = random.sample(nach, min(150, len(nach)))
|
|
faelle = vor + nach
|
|
print("Flop Suche:", len(vor), "Flop andere:", len(nach), "Schalter:", umg.get("MOTOR_HYB_RAKE"))
|
|
def lauf(exe, zusatz):
|
|
env = {**os.environ, **umg, **zusatz}
|
|
p = subprocess.Popen([exe] + ARGS, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, env=env, text=True,
|
|
creationflags=0x08000000 | 0x4000)
|
|
out = []
|
|
for r in faelle:
|
|
p.stdin.write(json.dumps(dict(r["q"], seed=r.get("seed") or 1)) + "\n"); p.stdin.flush()
|
|
out.append(json.loads(p.stdout.readline()))
|
|
p.kill(); return out
|
|
gl = lambda a, b: a.get("action") == b.get("action") and a.get("size") == b.get("size")
|
|
basis = lauf(BASIS, {})
|
|
aus = lauf(EXE, {})
|
|
an = lauf(EXE, {"MOTOR_HYB_FLOP_MAX": "1.0"})
|
|
print(f"Aus-Pruefung (neue Exe, Live-Schalter) gegen Live-Exe: {sum(map(gl, basis, aus))}/{len(basis)} gleich")
|
|
w = collections.Counter(); quelle = collections.Counter()
|
|
with open(os.path.join(HIER, "ergebnis.jsonl"), "a", encoding="utf-8") as o:
|
|
for r, a, b in zip(faelle, aus, an):
|
|
st = r["q"]["street"]; qa = "sharingan" if str(a.get("reason", "")).startswith("sharingan") else "motor"
|
|
qb = "sharingan" if str(b.get("reason", "")).startswith("sharingan") else "motor"
|
|
quelle[(st, qa, qb)] += 1
|
|
w[(st, qa, "gleich" if gl(a, b) else "anders")] += 1
|
|
o.write(json.dumps({"hand": r.get("hand"), "street": st, "aus": [a.get("action"), a.get("size"), a.get("reason")], "an": [b.get("action"), b.get("size"), b.get("reason")]}, ensure_ascii=False) + "\n")
|
|
print("Quelle aus->an:", dict(quelle)); print("Aenderungen:", dict(w))
|
|
for r, a, b in list(zip(faelle, aus, an))[:500]:
|
|
if not gl(a, b):
|
|
print(" ", a.get("action"), a.get("size"), "pot", r["q"].get("pot"), "->", b.get("action"), b.get("size"), "|", str(b.get("reason"))[:60])
|