Initial commit: 酒桌派对 / 大话骰 multiplayer drinking-game hub

- server.py: zero-dependency stdlib backend (HTTP + WebSocket /ws), 大话骰 rule engine, server-driven bots
- live.html: real MVP frontend wired to the backend over WebSocket
- index.html/app.js/style.css: older static prototype
- deploy/: systemd unit + Nginx reverse proxy + Let's Encrypt setup.sh
- test_*.py: standalone HTTP / in-process test scripts

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gongch
2026-06-17 10:05:10 +08:00
commit 6d1dd5d56c
28 changed files with 2167 additions and 0 deletions

24
test_zhai_rule.py Normal file
View File

@@ -0,0 +1,24 @@
import importlib.util
spec=importlib.util.spec_from_file_location('srv','/var/minis/workspace/drinking-games-ui/server.py')
srv=importlib.util.module_from_spec(spec); spec.loader.exec_module(srv)
room, host=srv.create_room('dice','房主','p-host')
for _ in range(3): srv.add_bot(room['code'],'p-host')
srv.start_room(room['code'],'p-host')
print('players', len(room['players']), srv.min_count(room), srv.next_call(room, None))
srv.call_dice(room['code'],'p-host',4,1)
print('call', room['currentCall'])
room['turnIndex']=0
try:
srv.call_dice(room['code'],'p-host',4,4)
print('bad same count accepted')
except Exception as e:
print('bad same count rejected', str(e))
room['turnIndex']=0
try:
srv.call_dice(room['code'],'p-host',6,2)
print('bad break accepted')
except Exception as e:
print('bad break rejected', str(e))
room['turnIndex']=0
srv.call_dice(room['code'],'p-host',8,2)
print('break ok', room['currentCall'])