Vier Zahlen standen gelesen, aber unbenutzt in roomProperties herum - kein_limp, rit_ab_bb/chop_ab_bb und anti_banking_s. Jetzt haengen sie an der Entscheidung: - rake.aus_tisch/netto: Rake mit dem Deckel des Tisches; ab vier Spielern greift der tiefere Deckel, gleich blind ist der Tisch damit billiger (tests/rake_tisch_spec.py) - tischregeln.startarten/start_erlaubt: an isNoLimp-Tischen nur pot-gross oder folden (tests/kein_limp_spec.py) - evchop.moeglich_fuer/rit_moeglich: Fenster und Mindest-Equity des Tisches statt fester Topfwerte (tests/schwellen_spec.py) - denkzeit.fristen/denkziel_ms/mit_tischuhr: Denkziel ohne die freie Extrazeit, Anti-Banking als Frist (tests/denkzeit_fristen_spec.py) Je Fall vorher rot. tests/lauf.py schnell gruen (1278 Faelle), docs/VERTRAG.md Byte-gleich.
65 lines
2.2 KiB
Python
65 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""No-Limp ist ein Format, kein Detail (lesen/tischregeln.py).
|
|
|
|
`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." Das Tischfeld ist `isNoLimp`.
|
|
|
|
An so einem Tisch faellt Limpen und das kleine Open weg: pot-gross oder folden. Die Zeilen unten
|
|
haben die Form einer Raumzeile des Clients.
|
|
|
|
python3 tests/kein_limp_spec.py -v
|
|
"""
|
|
import json
|
|
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
|
|
|
|
|
|
def zeile(**rp):
|
|
roh = json.dumps({"roomProperties": rp, "gameType": "Ring"}, separators=(",", ":"))
|
|
return '[Method] -> SendMessageToPipe - {"BeanData":%s,"Cmd":"game.game_alldata","RoomName":"T"}' \
|
|
% json.dumps(roh)
|
|
|
|
|
|
NOLIMP = zeile(isNoLimp=True, smallBlind=0.05, bigBlind=0.1)
|
|
NORMAL = zeile(isNoLimp=False, smallBlind=0.05, bigBlind=0.1)
|
|
|
|
|
|
class Startarten(unittest.TestCase):
|
|
def test_no_limp_tisch_nur_pot_oder_fold(self):
|
|
self.assertEqual(tischregeln.startarten(NOLIMP), ("POT", "FOLD"))
|
|
|
|
def test_normaler_tisch_laesst_limp_und_klein_zu(self):
|
|
arten = tischregeln.startarten(NORMAL)
|
|
self.assertIn("LIMP", arten)
|
|
self.assertIn("MIN", arten)
|
|
|
|
def test_an_no_limp_ist_limp_verboten(self):
|
|
self.assertFalse(tischregeln.start_erlaubt(NOLIMP, "LIMP"))
|
|
self.assertFalse(tischregeln.start_erlaubt(NOLIMP, "MIN"))
|
|
|
|
def test_an_no_limp_ist_pot_erlaubt(self):
|
|
self.assertTrue(tischregeln.start_erlaubt(NOLIMP, "POT"))
|
|
self.assertTrue(tischregeln.start_erlaubt(NOLIMP, "FOLD"))
|
|
|
|
def test_kleinschreibung_zaehlt_nicht(self):
|
|
self.assertTrue(tischregeln.start_erlaubt(NOLIMP, "pot"))
|
|
|
|
def test_ohne_raumzeile_gilt_standard(self):
|
|
self.assertIn("LIMP", tischregeln.startarten("nichts"))
|
|
|
|
def test_klartext_nennt_das_verbot(self):
|
|
self.assertIn("pot", tischregeln.klartext(tischregeln.regeln(NOLIMP)).lower())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|