Live on 7.11. the runner stood up right after sitting down at All-In-or-Fold tables: the fixed 8 BB buy-in is below the cash stop limit (20 BB). AoF now has its own money limits (never rebuy, the 4-seat rebuy click is not measured; stand up only on bust). The AoF client reports no call price (toCall 0 on all five AoF hold'em turns of 7.11., including facing an open all-in), so the Chen push/fold rule treated every call spot as a first push. The reader now derives it from the hand history, capped at the stack; a price the client does report still wins. Specs: tests/aof_geld_spec.py, tests/aof_preis_spec.py. Plan: plans/2026-11-25_aof.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
150 lines
6.5 KiB
Python
150 lines
6.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Spezifikation: der Preis (`toCall`) am All-In-or-Fold-Tisch (plans/2026-11-25_aof.md, Schritt 1).
|
|
|
|
Befund 7.11. (betrieb/scratch/shadow-2026-11-07.jsonl): an ALLEN fuenf AoF-Holdem-Zuegen stand
|
|
`toCall 0` - auch gegen einen offenen All-in (Easter Island 236220, Hand 23622000005: BB mit 4c3c,
|
|
SB ALL_IN 16000, Topf 18000, richtig waere 14000). Der AoF-Client meldet den Preis also weder in
|
|
`callAmount` noch in `userTurnOptions["4"]` (die Leiste ist nur Fold/All-in). Die Chen-Regel
|
|
(entscheiden/aof_push_fold) rechnete darum jede Call-Lage wie einen eigenen Erst-Push.
|
|
|
|
Regel: am AoF-Tisch ist der Preis der hoechste Einsatz der Strasse minus der eigene (Verlauf,
|
|
`betAmout` ist die Summe auf der Strasse), hoechstens der eigene Stapel. Meldet der Client einen
|
|
Preis, gilt er (Grundwahrheit). Am Ring-Tisch bleibt alles, wie es ist.
|
|
|
|
Fixture: die echte Hand 166270900125 aus archiv/rec-log.log (mmintel im BB gegen Raise auf 0,25),
|
|
der Tisch als Allinfold gesetzt (wie tests/aof_art_gedaechtnis_spec.py). Dazugeschrieben: der
|
|
eigene Zug ohne Preis (wie am AoF-Client), und fuer den Shove der Raise auf 10,0.
|
|
|
|
python3 tests/aof_preis_spec.py -v
|
|
"""
|
|
import json
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
_w = os.path.dirname(os.path.abspath(__file__))
|
|
sys.path.insert(0, _w)
|
|
from spielart_spec import RECLOG, NL_RAUM, NL_HAND, roh, alldata_stueck, mit_roomproperties # noqa: E402
|
|
from position_spec import bohne, umschreiben # noqa: E402
|
|
import spot_from_log # noqa: E402
|
|
import aof_push_fold # noqa: E402
|
|
|
|
BB = 0.1
|
|
SHOVE = 10.0
|
|
|
|
|
|
def _ist(zeile, cmd, **gleich):
|
|
if NL_HAND not in zeile or f'\\"Cmd\\":\\"{cmd}\\"' not in zeile and f'"Cmd":"{cmd}"' not in zeile:
|
|
return False
|
|
try:
|
|
m, d = bohne(zeile)
|
|
except (AttributeError, ValueError):
|
|
return False
|
|
return m.group(2) == cmd and all(d.get(k) == v for k, v in gleich.items())
|
|
|
|
|
|
def _eigener_zug(zeilen):
|
|
"""Index des ersten eigenen Zuges (mit Optionen) in der Hand: BB gegen den Raise."""
|
|
return next(i for i, z in enumerate(zeilen)
|
|
if _ist(z, "game.user_turn", whoseTurn="mmintel") and bohne(z)[1].get("userTurnOptions"))
|
|
|
|
|
|
def _raise(zeilen):
|
|
return next(i for i, z in enumerate(zeilen) if _ist(z, "game.seat", userName="wellfox13", caption="Raise"))
|
|
|
|
|
|
def anfragen(gametype="Allinfold", ohne_preis=True, shove=False, preis=None):
|
|
"""`preis`: der Client meldet diesen Preis (callAmount und "4") statt keinen."""
|
|
zeilen = list(roh(RECLOG))
|
|
if ohne_preis or preis is not None:
|
|
i = _eigener_zug(zeilen)
|
|
optionen = dict(bohne(zeilen[i])[1]["userTurnOptions"])
|
|
optionen["4"] = None if preis is None else [preis]
|
|
zeilen[i] = umschreiben(zeilen[i], callAmount=preis or 0.0, userTurnOptions=optionen)
|
|
if shove:
|
|
i = _raise(zeilen)
|
|
zeilen[i] = umschreiben(zeilen[i], betAmout=SHOVE)
|
|
text = "\n".join(zeilen)
|
|
stueck = alldata_stueck(RECLOG, NL_RAUM)
|
|
text = text.replace(stueck, mit_roomproperties(stueck, gameType=gametype))
|
|
return [json.loads(z) for z, _, raum, _, _ in spot_from_log.spots(text) if raum == NL_RAUM]
|
|
|
|
|
|
def vorflop(qs):
|
|
q, = [q for q in qs if q["street"] == "PREFLOP"]
|
|
return q
|
|
|
|
|
|
class AofPreisAusDemVerlauf(unittest.TestCase):
|
|
def test_bb_gegen_raise_zahlt_die_differenz(self):
|
|
# Raise auf 0,25, eigener Big Blind 0,10 -> Preis 0,15 (auch ohne Angabe des Clients)
|
|
q = vorflop(anfragen())
|
|
self.assertEqual(q["legalActions"], ["FOLD", "RAISE"])
|
|
self.assertAlmostEqual(q["toCall"], 0.15)
|
|
|
|
def test_gegen_shove_hoechstens_der_eigene_stapel(self):
|
|
# Shove auf 10,0 gegen 2,4 Stapel: der Call ist der ganze Stapel (Hand 23622000005)
|
|
q = vorflop(anfragen(shove=True))
|
|
self.assertAlmostEqual(q["toCall"], q["heroStack"])
|
|
self.assertGreater(q["heroStack"], 0)
|
|
|
|
def test_chen_regel_sieht_die_call_lage(self):
|
|
q = vorflop(anfragen(shove=True))
|
|
self.assertIn("AoF Call", aof_push_fold.entscheide(q)["reason"])
|
|
|
|
def test_preis_des_clients_gilt(self):
|
|
# Meldet der Client einen Preis, bleibt er (hier der echte Zug: "4" = [0.15])
|
|
q = vorflop(anfragen(ohne_preis=False))
|
|
self.assertAlmostEqual(q["toCall"], 0.15)
|
|
|
|
def test_preis_des_clients_schlaegt_den_verlauf(self):
|
|
# Fehlt eine Zeile im Log, rechnet der Verlauf falsch - ein gemeldeter Preis ist Grundwahrheit
|
|
q = vorflop(anfragen(preis=0.2))
|
|
self.assertAlmostEqual(q["toCall"], 0.2)
|
|
|
|
|
|
class AofPreisRegel(unittest.TestCase):
|
|
"""Die Regel direkt am Verlauf eines Tisches (Sitznummern roh, wie im Leser)."""
|
|
|
|
def tisch(self, *verlauf):
|
|
t = spot_from_log.Tisch("Easter Island 236220")
|
|
t.verlauf = [dict(zip(("street", "seat", "action", "amount"), r)) for r in verlauf]
|
|
return t
|
|
|
|
def test_hand_23622000005(self):
|
|
# SB postet 1000, BB 2000, SB ALL_IN auf 16000; BB hat 14000 hinter sich
|
|
t = self.tisch(("PREFLOP", 1, "POST_SB", 1000.0), ("PREFLOP", 2, "POST_BB", 2000.0),
|
|
("PREFLOP", 1, "ALL_IN", 16000.0))
|
|
self.assertEqual(t.aof_preis(2, 14000.0), 14000.0)
|
|
|
|
def test_sb_erst_push_zahlt_den_rest_des_big_blind(self):
|
|
t = self.tisch(("PREFLOP", 1, "POST_SB", 250.0), ("PREFLOP", 2, "POST_BB", 500.0))
|
|
self.assertEqual(t.aof_preis(1, 3750.0), 250.0)
|
|
|
|
def test_antes_zaehlen_nicht(self):
|
|
t = self.tisch(("PREFLOP", 3, "POST_ANTE", 900.0), ("PREFLOP", 1, "POST_SB", 250.0),
|
|
("PREFLOP", 2, "POST_BB", 500.0))
|
|
self.assertEqual(t.aof_preis(1, 3750.0), 250.0)
|
|
|
|
def test_board_vor_der_entscheidung_aendert_nichts(self):
|
|
# AoF-Omaha (Eiffel Tower 235093): eine Setzrunde, auch wenn das Board schon liegt
|
|
t = self.tisch(("PREFLOP", 2, "POST_SB", 1000.0), ("PREFLOP", 1, "POST_BB", 2000.0),
|
|
("PREFLOP", 2, "ALL_IN", 8000.0))
|
|
self.assertEqual(t.aof_preis(1, 6000.0), 6000.0)
|
|
|
|
|
|
class RingUnveraendert(unittest.TestCase):
|
|
def test_ring_ohne_angabe_bleibt_bei_null(self):
|
|
# Gegenprobe: nur am AoF-Tisch kommt der Preis aus dem Verlauf
|
|
q = vorflop(anfragen(gametype="Ring"))
|
|
self.assertEqual(q["toCall"], 0.0)
|
|
|
|
def test_ring_mit_angabe_unveraendert(self):
|
|
q = vorflop(anfragen(gametype="Ring", ohne_preis=False))
|
|
self.assertAlmostEqual(q["toCall"], 0.15)
|
|
self.assertIn("CALL", q["legalActions"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|