# Go-live-Tor fuer PROFIL_OHNE auf echten Live-Anfragen (mit echten Profilen des Clients): # golive-Replay (8 205 Anfragen), Echtgeld 19.11. (238), Pflichtfaelle (44). # a) Live-Kern 19d8cfeb, Live-Schalter (Referenz) # b) Profilteile-Kern, Live-Schalter (aus) -> muss a) gleich sein (Identitaet) # c) Profilteile-Kern, Live-Schalter + Arm (an) -> Kippungen gezaehlt, Praemie (Zwei Paar+ mit Hero-Karte, Overpair) # darf nie schwaecher spielen (Einsatz->Check, Call->Fold, Raise->Fold) # python -B -X utf8 tor.py "" -> messung/basis/ergebnis/tor.json + stdout import collections, json, os, sys sys.dont_write_bytecode = True HIER = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, HIER) import arme as AR # noqa: E402 import teile as T # noqa: E402 sys.path.insert(0, os.path.join(HIER, "..", "solver_kern", "spaet_fold")) import gate as G # noqa: E402 (Saetze, Praemien-Erkennung) TMP = os.path.join(AR.GS, "nach", "teile_tor") def norm(a): return (a.get("action"), round(a["size"], 3) if isinstance(a.get("size"), (int, float)) else None) def lauf(name, binr, env, S, pr): d = os.path.join(TMP, name) os.makedirs(d, exist_ok=True) ein, aus = os.path.join(d, "spots.jsonl"), os.path.join(d, "antw.jsonl") if not os.path.exists(aus): with open(ein, "w", encoding="utf-8", newline="\n") as f: for i, s in enumerate(S): f.write(json.dumps({"id": "%d" % i, "req": s["req"]}) + "\n") AR.KN.lf.lauf_entscheiden(ein, aus, binr, env, prozesse=pr, block=100) A = {json.loads(z)["id"]: json.loads(z) for z in open(aus, encoding="utf-8")} return [A.get("%d" % i, {}) for i in range(len(S))] def schwaecher(a, b): stark = {"RAISE": 3, "BET": 3, "ALL_IN": 3, "CALL": 2, "CHECK": 1, "FOLD": 0} return stark.get(b.get("action"), 1) < stark.get(a.get("action"), 1) def main(): pr, wert = int(sys.argv[1]), sys.argv[2] S = G.laden() env = AR.umgebung("live") a = lauf("a_live", T.BIN_L, env, S, pr) b = lauf("b_aus", T.BIN_T, env, S, pr) an = dict(env, PROFIL_OHNE=wert) c = lauf("c_an_" + wert.replace(",", "+")[:60], T.BIN_T, an, S, pr) st = collections.Counter() beispiele = [] for s, x, y, z in zip(S, a, b, c): st["n"] += 1 st["n_" + s["satz"]] += 1 if not x or not y or not z: st["leer"] += 1 continue if norm(x) != norm(y): st["aus_anders"] += 1 if norm(x) != norm(z): st["an_anders"] += 1 st["an_anders_" + str(s["req"].get("street"))] += 1 if x.get("action") != z.get("action"): st["an_kipp"] += 1 st["kipp_%s>%s" % (x.get("action"), z.get("action"))] += 1 pm = G.premium(s["req"]) if s["req"].get("street") != "PREFLOP" else None if pm and schwaecher(x, z): st["praemie_schwaecher"] += 1 beispiele.append({"satz": s["satz"], "nr": s["nr"], "praemie": pm, "live": norm(x), "an": norm(z), "grund": (z.get("reason") or "")[-160:]}) out = {"wert": wert, "stat": dict(st), "praemie_schwaecher": beispiele} json.dump(out, open(os.path.join(HIER, "ergebnis", "tor.json"), "w", encoding="utf-8", newline="\n"), indent=1, ensure_ascii=False) print(json.dumps(out, ensure_ascii=False, indent=1)[:3000]) if __name__ == "__main__": main()