- ESC no longer triggers the emergency stop (an ESC in another app stopped the run at 20:29); stopping only via ctrl-opt-cmd-S or the stop button - a table whose program runs counts as open even when its window is not visible (other desktop, Cockpit without screen recording): no reopening, no giving up, correct table count; teardown and closing a full table work over the channel - Cockpit checks and requests the screen recording permission - gapless tiling (sicht/kacheln.py): tables fill the full height, the Cockpit bar takes the rest and never goes below its minimum width; own animated resize no longer stored as minimum - earlier today: top-up safety net, leave after the hand (sit out next hand), tournament lock, waitlist left on close, Cockpit start lock, warning throttle, preflop raise-war reading, Bomb Pot practice, tournament break and level-up on the stage - teacher core for the streamer mode (betrieb/lehrer.py, betrieb/grund_lesen.py) and its plan
97 lines
4.3 KiB
Python
97 lines
4.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Eine Tischlage für Läufer und Cockpit (client/tischlage.py).
|
|
|
|
29.10.: nach einem Neustart von CoinPoker sagte das alte Client-Protokoll weiter "Platz 3 an
|
|
Big Ben 1673541" - das Cockpit zeigte einen Geister-Sitz, der Läufer meldete "Wiederaufnahme" und
|
|
öffnete den alten Tisch wieder. Wahr ist, was die Prozessliste sagt: jeder Tisch ist ein
|
|
eigener Prozess "CoinPoker Game" mit roomName=<Raum>.
|
|
|
|
* Tischprozess nur, wenn das Programm selbst der Unity-Tisch ist (Köder: Shell mit dem Text)
|
|
* offene Räume und Debug-Port aus einem ps-Aufruf
|
|
* ein Sitz aus dem Protokoll gilt nur, wenn der Tisch des Raums offen ist; unbekannt (Klon,
|
|
ps fehlt): alle Lagen bleiben
|
|
|
|
python3 tests/tischlage_spec.py -v
|
|
"""
|
|
import os
|
|
import sys
|
|
import types
|
|
import unittest
|
|
|
|
_w = os.path.dirname(os.path.abspath(__file__))
|
|
while _w != "/" and not os.path.isdir(os.path.join(_w, "lesen")):
|
|
_w = os.path.dirname(_w)
|
|
sys.path.insert(0, os.path.join(_w, "client"))
|
|
|
|
import tischlage
|
|
|
|
SPIEL = ("/Applications/CoinPoker.app/Contents/Resources/unity-resources-arm64/CoinPoker Game.app/"
|
|
"Contents/MacOS/CoinPoker serverIp=x:7000 roomName=Big Ben 1673541 isSuspectedFraud=false tableSize=6")
|
|
PS = ["37562 /Applications/CoinPoker.app/Contents/MacOS/CoinPoker --remote-debugging-port=9333",
|
|
"60467 " + SPIEL,
|
|
"60999 " + SPIEL.replace("1673541", "16735"),
|
|
"70001 /bin/zsh -c ed CoinPoker Game.app/Contents/MacOS/CoinPoker roomName=Big Ben 777 x=1"]
|
|
|
|
|
|
class Prozesse(unittest.TestCase):
|
|
def test_raum_aus_dem_befehl(self):
|
|
self.assertEqual(tischlage.raum_aus_befehl(SPIEL), "Big Ben 1673541")
|
|
self.assertIsNone(tischlage.raum_aus_befehl("/bin/zsh -c x " + SPIEL))
|
|
self.assertIsNone(tischlage.raum_aus_befehl(""))
|
|
|
|
def test_offene_raeume_und_port(self):
|
|
self.assertEqual(tischlage.raeume_aus_ps(PS), ["Big Ben 1673541", "Big Ben 16735"])
|
|
self.assertIs(tischlage.debug_port_aus_ps(PS), True)
|
|
self.assertIs(tischlage.debug_port_aus_ps(["1 /Applications/CoinPoker.app/Contents/MacOS/CoinPoker"]), False)
|
|
self.assertIsNone(tischlage.debug_port_aus_ps(PS[1:]))
|
|
|
|
def test_pid_fuer_raum(self):
|
|
self.assertEqual(tischlage.pid_fuer_raum(PS, "Big Ben 16735"), 60999)
|
|
self.assertIsNone(tischlage.pid_fuer_raum(PS, "Big Ben 777"))
|
|
|
|
|
|
class Sitze(unittest.TestCase):
|
|
def lagen(self):
|
|
sitzt = lambda p: types.SimpleNamespace(held_sitz=p)
|
|
return {"Big Ben 1": sitzt(3), "Big Ben 2": sitzt(1), "Big Ben 3": sitzt(None)}
|
|
|
|
def test_nur_mit_offenem_tisch(self):
|
|
self.assertEqual(sorted(tischlage.gueltige_lagen(self.lagen(), ["Big Ben 2"])), ["Big Ben 2"])
|
|
self.assertEqual(tischlage.gueltige_lagen(self.lagen(), []), {})
|
|
|
|
def test_unbekannt_laesst_alles(self):
|
|
self.assertEqual(sorted(tischlage.gueltige_lagen(self.lagen(), None)), ["Big Ben 1", "Big Ben 2", "Big Ben 3"])
|
|
|
|
|
|
class Verdeckt(unittest.TestCase):
|
|
"""5.11.2026 20:18-20:27: null Tischfenster bei bis zu sieben offenen Tischen (anderer
|
|
Schreibtisch davor, Cockpit ohne Bildschirmaufnahme). Ein Tisch, dessen Programm laeuft, ist
|
|
offen - verdeckt ist nur sein Fenster. `verdeckte`: offene Tische ohne sichtbares Fenster."""
|
|
|
|
OFFEN = ["Petra 1718918", "Great Sphinx 1720563", "Big Ben 1720266"]
|
|
|
|
def test_alle_sichtbar_keiner_verdeckt(self):
|
|
self.assertEqual(tischlage.verdeckte(self.OFFEN, self.OFFEN), ())
|
|
|
|
def test_kein_fenster_sichtbar_alle_verdeckt_in_der_reihe_von_ps(self):
|
|
self.assertEqual(tischlage.verdeckte([], self.OFFEN), tuple(self.OFFEN))
|
|
|
|
def test_teils_sichtbar_nur_die_fehlenden(self):
|
|
self.assertEqual(tischlage.verdeckte(["Great Sphinx 1720563"], self.OFFEN),
|
|
("Petra 1718918", "Big Ben 1720266"))
|
|
|
|
def test_fenster_ohne_raum_und_fremde_raeume_zaehlen_nicht(self):
|
|
self.assertEqual(tischlage.verdeckte([None, "NLH 123456", "Petra 1718918"], self.OFFEN),
|
|
("Great Sphinx 1720563", "Big Ben 1720266"))
|
|
|
|
def test_ohne_prozessliste_nichts_verdeckt(self):
|
|
"""Klon oder ps fehlt (`offene` None): unbekannt - nichts erfinden."""
|
|
self.assertEqual(tischlage.verdeckte([], None), ())
|
|
|
|
def test_ohne_offene_tische_nichts_verdeckt(self):
|
|
self.assertEqual(tischlage.verdeckte(["Petra 1718918"], []), ())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|