From ef039859313d9ef2a7b874e778b595992b0aa3a4 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Thu, 3 Dec 2026 12:02:30 +0100 Subject: [PATCH] Vorflop-Richter: Gewinnchance je Klasse gemittelt (eval7 beachtet Gewichte einer HandRange nicht; Eichung vorher +15,8, jetzt +0,2 +-0,6 Punkte) Co-Authored-By: Claude Opus 5.5 --- messung/motor/unsinn/richter_allin.py | 39 +++++++++++++++++++++------ 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/messung/motor/unsinn/richter_allin.py b/messung/motor/unsinn/richter_allin.py index 09a803b6..0310ebe8 100644 --- a/messung/motor/unsinn/richter_allin.py +++ b/messung/motor/unsinn/richter_allin.py @@ -136,12 +136,36 @@ def reichweite(ev, L, iso, E, pos, typ, kappa_pos, kappa_typ, haelfte): return m2, sum(pool) +_EQ_KLASSE = {} + + +def eq_gegen_klasse(hand, k, n): + """Gewinnchance gegen eine Klasse (alle verfuegbaren Kombinationen gleich gewichtet) und die Zahl verfuegbarer Kombinationen.""" + key = (tuple(sorted(hand)), k, n) + if key not in _EQ_KLASSE: + kombi = [(x, y) for (x, y) in KK[k] if x not in hand and y not in hand] + if not kombi: + _EQ_KLASSE[key] = (0.0, 0) + else: + hr = eval7.HandRange("AA") + hr.hands = [((eval7.Card(x), eval7.Card(y)), 1.0) for (x, y) in kombi] + _EQ_KLASSE[key] = (eval7.py_hand_vs_range_monte_carlo([eval7.Card(c) for c in hand], hr, [], n), len(kombi)) + return _EQ_KLASSE[key] + + def gewinnchance(hand, w, n=ZIEHUNGEN): - h = [eval7.Card(c) for c in hand] - hr = eval7.HandRange("AA") - hr.hands = [((eval7.Card(x), eval7.Card(y)), w[k] / kombos(k)) for k in range(KLASSEN) if w[k] > 0 for (x, y) in KK[k] - if x not in hand and y not in hand] - return eval7.py_hand_vs_range_monte_carlo(h, hr, [], n) + """Gewinnchance gegen die gewichtete Reichweite: je Klasse gerechnet und mit Klassengewicht x verfuegbare Kombos / alle Kombos gemittelt. + (eval7.py_hand_vs_range_monte_carlo beachtet die Gewichte einer HandRange NICHT; nur gleich gewichtete Kombos einer Klasse gehen hinein.)""" + num = den = 0.0 + je = max(n // 60, 2000) + for k in range(KLASSEN): + if w[k] <= 0: + continue + eq, verf = eq_gegen_klasse(hand, k, je) + g = w[k] * verf / kombos(k) + num += g * eq + den += g + return num / den if den > 0 else None def ev_call(eq, pot, zu, stack, bb, rake): @@ -177,8 +201,7 @@ def eichung(ev, kappa_pos, kappa_typ, zahl, rng): for e in kandidaten: if len(diffs) >= zahl: break - ck = KK[e["kc"]] - hand = list(rng.choice(ck)) + hand = list(KK[e["kc"]][0]) # feste Kombination je Klasse (Zwischenspeicher); Farben spielen kaum eine Rolle jk = [p for p in KK[e["k"]] if p[0] not in hand and p[1] not in hand] if not jk: continue @@ -206,7 +229,7 @@ def main(): a.add_argument("aenderungen") a.add_argument("lagen") a.add_argument("--haende", type=int, required=True) - a.add_argument("--eichung", type=int, default=2000) + a.add_argument("--eichung", type=int, default=800) o = a.parse_args() ev = lade_ereignisse(o.roh) evb = [e for e in ev if e["h"] == "B"]