Auto-play a random legal card when the turn timeout expires

This commit is contained in:
2026-09-16 21:46:06 +08:00
parent d9cdba33a1
commit 89cf0a4c96
14 changed files with 285 additions and 8 deletions
+10
View File
@@ -51,6 +51,7 @@ All configuration comes from environment variables (see `.env.example`):
| `OIDC_REDIRECT_URI` | `http://localhost:8080/auth/callback` | Login callback URL |
| `GAME_TTL_SECONDS` | `86400` | Sliding TTL of a live game in Redis |
| `HAND_ACK_TIMEOUT_SECONDS` | `30` | Seconds the between-hands scoring summary waits for acknowledgements |
| `TURN_TIMEOUT_SECONDS` | `30` | Seconds a player has to play before the server plays a random legal card for them |
| `APP_HOST` / `APP_PORT` | `0.0.0.0` / `8080` | Bind address |
## Data model
@@ -126,6 +127,15 @@ Client → server messages:
After every accepted move the new state is broadcast to all four players.
### Turn timeout
The state carries a `turn_deadline` while a hand is being played. If the
player on turn does not move before it, the server plays a random legal
card for them (picking one of the legal captures at random when a capture
is required), so a disconnected or idle player cannot stall the match. The
timeout is `TURN_TIMEOUT_SECONDS` (default 30); the auto-played move is
broadcast like any other.
### Hand-end summary
When a hand finishes but the match continues, the game enters the