Files
pokerfreak/tests/nie_verstreichen_spec.py
mmintel 9c79d8236b Acceptance 5.11.: channel play without AFK, quiet focus, working Cockpit, stronger play
- Practice tables: 20-min session 54/54 turns at the server, control session 28 turns,
  0 timeouts; stage: 3 tables, two rounds each, clean teardown.
- Never let the clock run: an engine abstention becomes check or fold (nie_verstreichen).
- Mittler join in a fixed order (kill the duplicate, then announce), a mittler ends with its
  game, the laufwache opens no tables, stop waits for the runner to stand up.
- Focus: no lobby connections from HUD, probes or layout; "Focus Window on Turn" off.
- Tables: disconnected or sitting-out opponents do not count; a table without channel is
  closed and avoided after 45 s; the join event keeps the writer's pid (strict invariants).
- Geldwache: same room list as the runner, the table's own report, stand up before closing.
- Engine: the small blind completes the top 65 % against limpers (price per fair share);
  the calling range of a bet is as wide as the villain calls - value bets into stations.
- Cockpit: the source tree never comes from SHELL; one operating set for laufwache and
  Cockpit (sicht/start.py --client, ServerStart).
- Project lives in ~/Projects/pokerfreak (kern was a detour).
2026-11-05 16:10:43 +01:00

54 lines
2.1 KiB
Python

#!/usr/bin/env python3
"""Kein eigener Zug verstreicht: enthaelt sich der Kern, spielt der Laeufer check - sonst fold.
Anlass 5.11. 12:35 (Abnahme, Easter Island 1718131): auf dem Flop lieferte der Kern ABSTAIN
(Konfidenz 0.30, toCall 8500), der Laeufer setzte "aus" - die Uhr lief ab, der Server schrieb
"Since you are timed-out, you will sit-out in the next hand" und setzte uns aus. Ein ausgelassener
Zug kostet mehr als jeder Fold.
python3 tests/nie_verstreichen_spec.py -v
"""
import os
import sys
import tempfile
import unittest
HIER = os.path.dirname(os.path.abspath(__file__))
WURZEL = os.path.dirname(HIER)
ORDNER = tempfile.mkdtemp(prefix="pf-verstreichen-")
os.environ["SCRATCH"] = ORDNER
os.environ["STATS_DIR"] = os.path.join(ORDNER, "statistik")
os.environ["SPERRE"] = os.path.join(ORDNER, "laeufer.pid")
for _u in ("betrieb", "hand", "client", "lesen", "entscheiden", "lobby", "mcp"):
_p = os.path.join(WURZEL, _u)
if _p not in sys.path:
sys.path.append(_p)
import runner # noqa: E402
class NieVerstreichen(unittest.TestCase):
def test_enthaltung_ohne_einsatz_wird_check(self):
aus = runner.nie_verstreichen({"action": "ABSTAIN", "confidence": 0.3}, {"toCall": 0.0})
self.assertEqual(aus["action"], "CHECK")
def test_enthaltung_mit_einsatz_wird_fold(self):
aus = runner.nie_verstreichen({"action": "ABSTAIN", "confidence": 0.297}, {"toCall": 8500.0})
self.assertEqual(aus["action"], "FOLD")
def test_ohne_aktion_ebenso(self):
self.assertEqual(runner.nie_verstreichen({}, {"toCall": 200.0})["action"], "FOLD")
self.assertEqual(runner.nie_verstreichen({"action": None}, {})["action"], "CHECK")
def test_der_grund_nennt_die_enthaltung(self):
aus = runner.nie_verstreichen({"action": "ABSTAIN", "reason": "unsicher"}, {"toCall": 1.0})
self.assertIn("unsicher", aus["reason"])
def test_eine_entscheidung_bleibt_wie_sie_ist(self):
antwort = {"action": "RAISE", "size": 1250, "confidence": 0.998}
self.assertEqual(runner.nie_verstreichen(antwort, {"toCall": 500.0}), antwort)
if __name__ == "__main__":
unittest.main(verbosity=2)