40 lines
2.3 KiB
Python
40 lines
2.3 KiB
Python
"""Fremdpruefung 4, Nachtrag: welche der als Splash markierten eigenen Haende hatten echtes Splash-Geld?
|
|
Liest die Roh-Logs (game.splash_the_pot dropAmount, game.potInfo splashPotDropAmount, isMegaSplash),
|
|
verbindet mit daten/eigen_alle.csv (netto_cent je Hand aus ergebnis.py).
|
|
python -I -X utf8 splash_pruef.py <rohlog-ordner>"""
|
|
import sys, os, gzip, glob, re, csv, collections
|
|
roh = sys.argv[1]
|
|
drop = collections.defaultdict(float); markiert = set(); mega = set()
|
|
rx_id = re.compile(r'\\"gameHandId\\":\\"?(\d+)')
|
|
for f in sorted(glob.glob(os.path.join(roh, "*.log.gz"))):
|
|
with gzip.open(f, "rt", encoding="utf-8", errors="replace") as fh:
|
|
for z in fh:
|
|
if "splash" not in z.lower() or "BeanData" not in z: continue
|
|
m = rx_id.search(z)
|
|
if not m: continue
|
|
h = m.group(1)
|
|
if "game.splash_the_pot" in z or "game.mega_splash" in z:
|
|
markiert.add(h)
|
|
d = re.search(r'\\"dropAmount\\":([0-9.]+)', z)
|
|
if d and float(d.group(1)) > 0: drop[h] = max(drop[h], float(d.group(1)))
|
|
if re.search(r'\\"megaSplash\\":true', z) or "game.mega_splash" in z: mega.add(h)
|
|
d = re.search(r'\\"splashPotDropAmount\\":([0-9.]+)', z)
|
|
if d and float(d.group(1)) > 0: drop[h] = max(drop[h], float(d.group(1)))
|
|
if re.search(r'\\"isMegaSplash\\":true', z): mega.add(h); markiert.add(h)
|
|
netto = {}
|
|
for r in csv.DictReader(open("daten/eigen_alle.csv", encoding="utf-8")):
|
|
netto[r["hand"]] = (int(r["netto_cent"]) if r["netto_cent"] not in ("", None) else None, float(r["bb"]))
|
|
def summe(ids):
|
|
v = [netto[h] for h in ids if h in netto and netto[h][0] is not None]
|
|
return len(v), sum(c / 100 / bb for c, bb in v)
|
|
alle = [h for h in netto if netto[h][0] is not None]
|
|
echt = {h for h in drop}
|
|
print("Haende mit Netto:", summe(alle))
|
|
print("markiert (splash/mega-Event):", len(markiert), "davon mit Netto", summe(markiert & set(alle)))
|
|
print("echtes Splash-Geld (drop>0):", len(echt), "mit Netto", summe(echt & set(alle)), "Summe drop", round(sum(drop.values()), 2))
|
|
print("mega-Flag:", len(mega), summe(mega & set(alle)))
|
|
fa = (markiert - echt) & set(alle)
|
|
print("Fehlalarm (markiert, drop=0):", summe(fa))
|
|
n, s = summe(alle); n2, s2 = summe(set(alle) - echt)
|
|
print(f"bb/100 alle {100*s/n:.1f} | ohne echte Splash {100*s2/n2:.1f} (n={n2})")
|