Turniermotor: nach dem Flop keine ICM-Wendung von Fold/Check/Call zu Bet/Raise (Hand 275729600032, -9800)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 21:39:42 +01:00
co-authored by Claude Opus 5.5
parent 789010bcfd
commit 07c8120800
2 changed files with 59 additions and 1 deletions
+23 -1
View File
@@ -7,6 +7,7 @@ Jede Antwort steht in archiv/lauf/turniermotor.jsonl. Wirft nie. Cash beruehrt e
"""
import json
import os
import re
import queue
import threading
import time
@@ -39,6 +40,27 @@ def einpassen(q, r):
return r
_ICM_ANGRIFF = re.compile(r"ICM(?:\+Bounty)?: (FOLD|CHECK|CALL) -> (BET|RAISE)\b")
def ohne_icm_angriff(q, r):
"""Nach dem Flop macht die ICM-Schicht keinen Angriff aus einem passiven Zug (26.11. Hand 275729600032: 4d6d am
Turn A3A8, Motor fold 55 %/call 40 %, ICM drehte FOLD -> RAISE auf das 13-fache des Einsatzes, Gegner all-in,
-9800). Die Auszahlung macht vorsichtiger, nicht aggressiver; ihr Ausrollen kennt die Gegner am Freeroll nicht.
Dann gilt der Zug der Strategie (der vor dem Pfeil). Vor dem Flop (Push/Fold) bleibt die ICM-Wahl."""
if not isinstance(r, dict) or q.get("street") in (None, "PREFLOP") or r.get("action") not in ("BET", "RAISE"):
return r
m = _ICM_ANGRIFF.search(str(r.get("reason") or ""))
if not m:
return r
alt = m.group(1)
if alt == "CHECK" and (q.get("toCall") or 0) > 0:
alt = "FOLD"
if alt not in (q.get("legalActions") or ()) and alt != "FOLD":
return r
return dict(r, action=alt, size=None, reason=f"{r.get('reason')} | ICM-Angriff nach dem Flop verworfen -> {alt}")
class _Einpassend:
"""Die Leitung zum Dienst, die jede Antwort an die zuletzt gestellte Frage einpasst (`einpassen`)."""
@@ -61,7 +83,7 @@ class _Einpassend:
zeile = self.p.stdout.readline()
try:
r = json.loads(zeile)
neu = einpassen(self.frage, r)
neu = einpassen(self.frage, ohne_icm_angriff(self.frage, r))
if neu is not r:
return json.dumps(neu) + "\n"
except Exception:
+36
View File
@@ -127,6 +127,42 @@ class Einpassen(unittest.TestCase):
self.assertEqual(json.loads(e.stdout.readline())["size"], 1133.0)
class IcmAngriff(unittest.TestCase):
Q = {"street": "TURN", "toCall": 500.0, "legalActions": ["FOLD", "CALL", "RAISE"], "minRaiseTo": 1000.0, "maxRaiseTo": 20336.0}
R = {"action": "RAISE", "size": 6455.0, "reason": "Turnier t8-20 (19.6 bb, ICM) ICM: FOLD -> RAISE (+0.85 bb in Geld); motor TURN"}
def test_turn_fold_bleibt_fold(self):
r = turniermotor.ohne_icm_angriff(self.Q, self.R)
self.assertEqual((r["action"], r["size"]), ("FOLD", None))
def test_call_bleibt_call(self):
r = turniermotor.ohne_icm_angriff(self.Q, dict(self.R, reason="ICM+Bounty: CALL -> RAISE (+1 bb in Geld)"))
self.assertEqual(r["action"], "CALL")
def test_vorflop_bleibt(self):
q = dict(self.Q, street="PREFLOP")
self.assertIs(turniermotor.ohne_icm_angriff(q, self.R), self.R)
def test_eigener_raise_bleibt(self):
r = dict(self.R, reason="Turnier t8-20 motor TURN: 0.80x 60%")
self.assertIs(turniermotor.ohne_icm_angriff(self.Q, r), r)
def test_leitung_wendet_an(self):
class Rohr:
pid = 1
def __init__(s):
s.stdin, s.stdout = s, s
def write(s, t):
pass
def flush(s):
pass
def readline(s):
return json.dumps(IcmAngriff.R) + "\n"
e = turniermotor._Einpassend(Rohr())
e.stdin.write(json.dumps(self.Q) + "\n")
self.assertEqual(json.loads(e.stdout.readline())["action"], "FOLD")
class Formattuer(unittest.TestCase):
def test_turniersitz_kommt_durch(self):
import runner