Design an Online Chess Platform: Elo Matchmaking, WebSocket Moves, Game Clocks
Company: OpenAI
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Onsite
Design an online chess platform in the style of Chess.com. Players look for a game and are matched with an opponent of similar strength by Elo rating, play the game in real time with moves delivered over WebSocket connections, and each player has a game clock that must be enforced fairly.
Focus the design on three areas: **rating-based matchmaking**, **real-time move delivery over WebSockets**, and **game clocks (timers)**. Cover the rest of the platform (accounts, game history) only as needed.
```hint Who is the source of truth
Decide which component owns each game's state and clocks, and what every other component is allowed to do with a move before that owner has accepted it.
```
```hint Matching is a trade-off over time
Consider how the acceptable rating gap for a waiting player should change the longer that player waits.
```
### Clarifying Questions
- How many concurrent players and games at peak, and which time controls (bullet, blitz, rapid, daily)?
- Must players be matched within a few seconds, or is waiting longer for a closer rating acceptable?
- How should network latency be treated on the clock: should a player be charged for time their move spent in transit?
- What happens when a player disconnects in the middle of a game?
- Are spectators, chat and anti-cheat in scope?
### What a Strong Answer Covers
- Capacity estimates for connections, games and moves per second
- A matchmaking design that balances rating closeness against wait time, and scales across many waiting players
- A real-time architecture: connection handling, routing a game's traffic to its owner, fan-out to both players and spectators, and reconnection
- Server-authoritative clocks, fair treatment of latency, and correct handling of time forfeits and disconnections
- Move validation, game state persistence, recovery when a game server fails, and rating updates after the game
### Follow-up Questions
- A game server crashes in the middle of a bullet game. What do the players experience, and how does the game resume?
- How would you support 100,000 spectators watching one top-level game?
- How would you detect players who are using a chess engine?
- How would you prevent rating manipulation, such as two accounts deliberately losing to each other?
Overview: Design an online chess platform: match players of similar Elo rating quickly, deliver moves in real time over WebSocket connections, and enforce fair game clocks despite network latency and disconnections. It tests matchmaking, stateful real-time architecture, server-authoritative timing and failover.