Files
pokerfreak/messung/overbet/linien.py
T

29 lines
1.7 KiB
Python

"""Postflop-Aggression >= 1,2 Pot oder All-in (Rest <= 3 bb) im Live-Cash 0.01/0.02 ab 14.11., nach Handklasse.
Aufruf: python messung/overbet/linien.py <lauf-ordner>/ -> eine Zeile je Entscheidung (Hand-ID, Karten, keine Namen)."""
import json, collections, os, sys
ZEIT = os.environ.get('AB', '2026-11-14')
L = sys.argv[1]
H = {}
for l in open(L + 'haende.jsonl', encoding='utf-8'):
h = json.loads(l)
if h.get('zeit', '') >= ZEIT and h.get('stake') == '0.01/0.02': H[h['hand']] = h
STARK = ('Straight', 'Flush', 'FullHouse', 'FourOfAKind', 'StraightFlush')
rows = []; g = collections.defaultdict(list); seen = set()
for l in open(L + 'zuege.jsonl', encoding='utf-8'):
z = json.loads(l); h = H.get(z.get('hand'))
if not h or z['street'] == 'PREFLOP' or z['aktion'] not in ('BET', 'RAISE', 'ALL_IN'): continue
sp = z.get('spot') or {}; bb = h['bb']; to = z.get('groesse') or 0
stack = sp.get('heroStack') or 0; pot = sp.get('pot') or z['pot'] or 1e-9
rest = (stack - to) / bb if stack > 0 else 99
if not (to / pot >= 1.2 or rest <= 3 or z['aktion'] == 'ALL_IN'): continue
if z['klasse'] in STARK: k = 'stark'
else: k = z['klasse']
first = z['hand'] not in seen; seen.add(z['hand'])
res = h['netto'] / bb
if first: g[k].append(res)
rows.append(dict(hand=z['hand'], street=z['street'], toCall=sp.get('toCall', z.get('toCall')), aktion=z['aktion'],
klasse=z['klasse'], to=round(to / bb, 1), pot=round(pot / bb, 1), rest=round(rest, 1),
netto=round(res, 1), hole=' '.join(z['hole']), board=' '.join(z['board']), grund=(z['grund'] or '')[:90], erste=first))
for k, v in sorted(g.items()): print(f'# {k:14s} n={len(v):3d} sum={sum(v):7.1f}')
for r in rows: print(json.dumps(r, ensure_ascii=False))