- 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>
16 lines
635 B
Python
16 lines
635 B
Python
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(2): srv.add_bot(room['code'],'p-host')
|
|
srv.start_room(room['code'],'p-host')
|
|
print('players', len(room['players']), 'min', srv.min_count(room))
|
|
try:
|
|
srv.call_dice(room['code'],'p-host',3,2)
|
|
print('bad accepted')
|
|
except Exception as e:
|
|
print('bad rejected', str(e))
|
|
room['turnIndex']=0
|
|
srv.call_dice(room['code'],'p-host',3,1)
|
|
print('ok', room['currentCall'])
|