Der Laeufer holt die Zahlen je Raum einmal (tischzahlen.je_raum ueber den Text, den er ohnehin liest) und gibt sie an die zwei Stellen weiter, an denen sie hingehoeren: - tischregeln.no_limp_anpassen: an einem No-Limp-Tisch wird der Limp und das zu kleine Open pot-gross (raiseTo = pot + 2*toCall, gedeckelt an minRaiseTo/maxRaiseTo); wer schon einem Raise gegenuebersteht, behaelt seinen Call; ohne Raise-Recht wird gefoldet. Die Antwort des Kerns wird nicht veraendert, sondern ersetzt. - denkzeit.gedenkzeit_ms nimmt jetzt auch "zahlen" statt nur Text - die Gedenkzeit haengt an der Bedenkzeit des Tisches, nicht an der am Zug gemessenen Uhr. Je Fall vorher rot. tests/lauf.py schnell gruen (1302 Faelle), docs/VERTRAG.md Byte-gleich.
107 lines
4.0 KiB
Python
107 lines
4.0 KiB
Python
#!/usr/bin/env python3
|
|
"""An einem No-Limp-Tisch ist der erste freie Einsatz pot-gross oder folden.
|
|
|
|
`AppStaticConfig.noLimpConfig`: "The first voluntary action into an unopened pot cannot be a limp or
|
|
call. Players must either open with a pot-sized bet or fold." Also faellt der Limp weg und das
|
|
kleine Open wird zum pot-grossen Raise. Wer schon einem Raise gegenuebersteht, ist nicht mehr der
|
|
erste freie Einsatz - der Call bleibt.
|
|
|
|
Gegen ein pot-grosses Open geprueft: raiseTo = pot + 2 * toCall, gedeckelt an minRaiseTo/maxRaiseTo.
|
|
|
|
python3 tests/no_limp_anpassung_spec.py -v
|
|
"""
|
|
import os
|
|
import sys
|
|
import unittest
|
|
|
|
HIER = os.path.dirname(os.path.abspath(__file__))
|
|
WURZEL = os.path.dirname(HIER)
|
|
for p in (WURZEL, os.path.join(WURZEL, "lesen")):
|
|
if p not in sys.path:
|
|
sys.path.insert(0, p)
|
|
|
|
import tischregeln
|
|
|
|
Z = {"kein_limp": True, "big_blind": 0.1}
|
|
|
|
|
|
def anfrage(**ueber):
|
|
a = {"street": "PREFLOP", "pot": 0.15, "toCall": 0.1, "bigBlind": 0.1, "minRaiseTo": 0.2,
|
|
"maxRaiseTo": 20.0, "legalActions": ["FOLD", "CALL", "RAISE"], "heroStack": 10.0}
|
|
a.update(ueber)
|
|
return a
|
|
|
|
|
|
def call():
|
|
return {"action": "CALL", "size": None, "confidence": 0.6, "reason": "gut"}
|
|
|
|
|
|
class Limp(unittest.TestCase):
|
|
def test_limp_wird_pot_gross(self):
|
|
neu = tischregeln.no_limp_anpassen(anfrage(), call(), Z)
|
|
self.assertEqual(neu["action"], "RAISE")
|
|
self.assertAlmostEqual(neu["size"], 0.15 + 2 * 0.1, places=4)
|
|
self.assertIn("kein Limp", neu["reason"])
|
|
|
|
def test_die_ursprungsantwort_bleibt_unberuehrt(self):
|
|
alt = call()
|
|
tischregeln.no_limp_anpassen(anfrage(), alt, Z)
|
|
self.assertEqual(alt["action"], "CALL")
|
|
|
|
def test_am_normalen_tisch_bleibt_der_limp(self):
|
|
self.assertEqual(tischregeln.no_limp_anpassen(anfrage(), call(), {})["action"], "CALL")
|
|
|
|
def test_fold_bleibt_fold(self):
|
|
self.assertEqual(tischregeln.no_limp_anpassen(anfrage(), {"action": "FOLD"}, Z)["action"],
|
|
"FOLD")
|
|
|
|
def test_gegen_einen_raise_bleibt_der_call(self):
|
|
"""toCall ueber der Blind heisst: es ist schon eroeffnet - kein Limp."""
|
|
neu = tischregeln.no_limp_anpassen(anfrage(toCall=0.4), call(), Z)
|
|
self.assertEqual(neu["action"], "CALL")
|
|
|
|
def test_bb_option_bleibt(self):
|
|
self.assertEqual(tischregeln.no_limp_anpassen(anfrage(toCall=0.0), call(), Z)["action"],
|
|
"CALL")
|
|
|
|
def test_postflop_bleibt(self):
|
|
self.assertEqual(tischregeln.no_limp_anpassen(anfrage(street="FLOP"), call(), Z)["action"],
|
|
"CALL")
|
|
|
|
|
|
class KleinesOpen(unittest.TestCase):
|
|
def test_zu_kleiner_raise_wird_pot_gross(self):
|
|
neu = tischregeln.no_limp_anpassen(anfrage(), {"action": "RAISE", "size": 0.2}, Z)
|
|
self.assertAlmostEqual(neu["size"], 0.35, places=4)
|
|
|
|
def test_pot_grosser_raise_bleibt(self):
|
|
alt = {"action": "RAISE", "size": 0.35}
|
|
self.assertEqual(tischregeln.no_limp_anpassen(anfrage(), alt, Z)["size"], 0.35)
|
|
|
|
def test_groesserer_raise_bleibt(self):
|
|
alt = {"action": "RAISE", "size": 1.0}
|
|
self.assertEqual(tischregeln.no_limp_anpassen(anfrage(), alt, Z)["size"], 1.0)
|
|
|
|
|
|
class Grenzen(unittest.TestCase):
|
|
def test_ohne_raise_recht_wird_der_limp_zum_fold(self):
|
|
neu = tischregeln.no_limp_anpassen(anfrage(legalActions=["FOLD", "CALL"]), call(), Z)
|
|
self.assertEqual(neu["action"], "FOLD")
|
|
|
|
def test_ohne_raise_recht_gegen_einen_raise_bleibt_call(self):
|
|
neu = tischregeln.no_limp_anpassen(anfrage(toCall=0.4, legalActions=["FOLD", "CALL"]),
|
|
call(), Z)
|
|
self.assertEqual(neu["action"], "CALL")
|
|
|
|
def test_obergrenze_deckelt_das_open(self):
|
|
neu = tischregeln.no_limp_anpassen(anfrage(maxRaiseTo=0.25), call(), Z)
|
|
self.assertEqual(neu["size"], 0.25)
|
|
|
|
def test_mindest_raise_wird_nicht_unterschritten(self):
|
|
neu = tischregeln.no_limp_anpassen(anfrage(pot=0.02, minRaiseTo=0.3), call(), Z)
|
|
self.assertEqual(neu["size"], 0.3)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|