Design an online chess game with undo and leaderboard
Company: Meta
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
## Scenario
Design a real-time online chess game service.
## Core requirements
- Users can **challenge friends** and start a game session.
- Two players take turns making moves.
- A player may **undo (take back) moves only until the opponent makes their next move**.
- Interpreting this strictly: after you make a move, you can retract it as long as the opponent has not responded with their move yet.
- Provide a **leaderboard** that can show **all users’ rankings by score at any time**.
## Non-functional requirements (clarify assumptions)
- Support many concurrent games.
- Low-latency move delivery (near real time).
- Correctness: legal move validation, turn ordering, no double moves.
- Basic reliability and auditability (game history, dispute resolution).
## Out of scope (unless you choose to include)
- Anti-cheat engine detection, spectating, chat, tournaments, puzzles.
Quick Answer: This question evaluates proficiency in real-time system design, state management, and concurrency control for multiplayer games, including consistency, undo semantics, low-latency messaging, game-state validation, auditability, and leaderboard computation.