Design a service that matches two players, maintains authoritative legal game state, supports clocks, and allows games to be reviewed later.
Question
Design a service that matches two players, maintains authoritative legal game state, supports clocks, and allows games to be reviewed later.
## Requirements
- Define APIs or real-time events for matchmaking, moves, resignations, draw offers, reconnects, and spectators.
- The server—not the client—validates turns, legal moves, check, checkmate, stalemate, and special rules.
- Make duplicate or reordered client messages idempotent.
- Maintain fair clocks despite network delay and disconnects.
- Persist an append-only move history and enough state for fast reconnect and review.
- State scale assumptions, latency goals, and consistency boundaries.
Describe the game actor or transaction model, storage schema, real-time transport, and how ownership changes during failover.
## Follow-ups
1. Add tournaments, ratings, and anti-cheat signals.
2. Scale spectators for a popular match.
3. Recover an active game when its host crashes.
4. Support takebacks or alternative chess variants.
The public brief is identical for people and crawlers. Account access changes tools, not the indexed description.