11,3 Mio. CoinPoker-NL2-Haende (nur Aggregate), Spieler-Holdout, EV ueber gemessene Fortsetzungen. Schalter (aus = bitgleich, in BEKANNTE_SCHALTER): Blind-3-Bet gegen EP/MP 3x, gegen CO/BTN 4x das Open (bisher 1,5-2,4x: 3 x to_call ohne eigenen Blind), Iso in Position 5 bb + 1 je weiteren Limper (bisher 2,5 bb). VORFLOP_BAND, Iso aus den Blinds, HU unveraendert. Tor: Eigen-Replay 1130 Spots 0 Aktionen anders (nur Groessen), Pflichtfaelle 35/43 wie live, Mehrweg-LBR -16,65 +-32,05 (nicht schlechter), 6-max-Leiter +16,87 +-3,28 ohne schlechtere Position. Nicht live geschaltet. Bericht messung/vorflop_population/BERICHT.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
97 lines
2.7 KiB
Python
97 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Hilfen: Handklassen (169, Raster wie src/cfr/hand_class.rs), Equity-Matrix aus src/cfr/generated_equity.rs,
|
|
Rangfolge und Baender."""
|
|
import os
|
|
import re
|
|
|
|
import numpy as np
|
|
|
|
R = "23456789TJQKA"
|
|
_HIER = os.path.dirname(os.path.abspath(__file__))
|
|
_WURZEL = os.path.dirname(os.path.dirname(_HIER))
|
|
|
|
|
|
def klasse_von(k1, k2):
|
|
"""Karten 0..51 (Rang*4+Farbe) -> Klassen-Id (numpy-faehig)."""
|
|
k1 = np.asarray(k1, np.int64)
|
|
k2 = np.asarray(k2, np.int64)
|
|
r1, r2 = k1 // 4, k2 // 4
|
|
hi, lo = np.maximum(r1, r2), np.minimum(r1, r2)
|
|
suited = (k1 % 4) == (k2 % 4)
|
|
return np.where(hi == lo, hi * 13 + hi, np.where(suited, hi * 13 + lo, lo * 13 + hi))
|
|
|
|
|
|
def name(c):
|
|
row, col = divmod(int(c), 13)
|
|
if row == col:
|
|
return R[row] * 2
|
|
if row > col:
|
|
return R[row] + R[col] + "s"
|
|
return R[col] + R[row] + "o"
|
|
|
|
|
|
def id_von_name(n):
|
|
a, b = R.index(n[0]), R.index(n[1])
|
|
hi, lo = max(a, b), min(a, b)
|
|
if hi == lo:
|
|
return hi * 13 + hi
|
|
return hi * 13 + lo if n.endswith("s") else lo * 13 + hi
|
|
|
|
|
|
def kombos():
|
|
k = np.zeros(169)
|
|
for c in range(169):
|
|
row, col = divmod(c, 13)
|
|
k[c] = 6 if row == col else (4 if row > col else 12)
|
|
return k
|
|
|
|
|
|
KOMBOS = kombos()
|
|
|
|
|
|
def equity_matrix():
|
|
txt = open(os.path.join(_WURZEL, "src", "cfr", "generated_equity.rs"), encoding="utf-8").read()
|
|
body = txt.split("TRIANGLE: [u16; 14365] = [", 1)[1].split("];", 1)[0]
|
|
t = np.array([int(x) for x in re.findall(r"\d+", body)], np.float64) / 10000.0
|
|
assert len(t) == 14365
|
|
E = np.zeros((169, 169))
|
|
k = 0
|
|
for i in range(169):
|
|
for j in range(i, 169):
|
|
E[i, j] = t[k]
|
|
E[j, i] = 1.0 - t[k]
|
|
k += 1
|
|
return E
|
|
|
|
|
|
E = equity_matrix()
|
|
# Rangfolge: Equity gegen eine Zufallshand (kombogewichtet); Perzentil 0 = beste
|
|
_gg_zufall = E @ KOMBOS / KOMBOS.sum()
|
|
ORDNUNG = np.argsort(-_gg_zufall)
|
|
_kum = np.cumsum(KOMBOS[ORDNUNG]) / KOMBOS.sum()
|
|
PERZENTIL = np.zeros(169)
|
|
PERZENTIL[ORDNUNG] = _kum - KOMBOS[ORDNUNG] / KOMBOS.sum() / 2
|
|
|
|
|
|
def band(lo, hi, ordnung=None):
|
|
"""Kombogewichte (0..1 je Klasse) fuer das Perzentil-Band [lo, hi) der Rangfolge."""
|
|
o = ORDNUNG if ordnung is None else ordnung
|
|
kum = np.cumsum(KOMBOS[o]) / KOMBOS.sum()
|
|
start = kum - KOMBOS[o] / KOMBOS.sum()
|
|
anteil = np.clip((np.minimum(kum, hi) - np.maximum(start, lo)) / (kum - start), 0, 1)
|
|
w = np.zeros(169)
|
|
w[o] = anteil
|
|
return w * KOMBOS
|
|
|
|
|
|
def eq(h, w):
|
|
"""Equity der Klasse h gegen die Range mit Kombogewichten w."""
|
|
s = w.sum()
|
|
return float(E[h] @ w / s) if s > 0 else 0.5
|
|
|
|
|
|
def eq_mehr(es):
|
|
"""Naeherung Mehrweg-Equity aus Einzel-Equities."""
|
|
es = [min(max(e, 1e-6), 1 - 1e-6) for e in es]
|
|
return 1.0 / (1.0 + sum((1 - e) / e for e in es))
|