Personal · 2023
Tic-Tac-Toe Online
Real-time multiplayer game with an unbeatable AI

Overview
An online Tic-Tac-Toe that looks simple and isn't: real-time multiplayer over WebSockets, an unbeatable AI via Minimax with alpha-beta pruning, and PWA support for offline play.
The Problem
The game is trivial; the engineering isn't. Two players on flaky connections must see one consistent board, and the AI must be provably unbeatable without freezing the UI.
The Solution
Server-authoritative game state over WebSockets — clients render, the server decides — plus a pruned Minimax engine that evaluates instantly. Installable as a PWA with a full offline mode against the AI.
Architecture
- WebSocket rooms with server-authoritative state to prevent desync and cheating.
- Minimax with alpha-beta pruning — optimal play with a fraction of the search space.
- Service worker for offline play and installability.
Key Features
- Real-time online multiplayer with rooms
- Unbeatable AI opponent
- Offline play as an installable PWA
- Sound effects and cross-device responsive UI
Challenges
Consistency over flaky connections
Letting clients apply moves optimistically caused desync on reconnect. Moving to server-authoritative state with client rendering eliminated an entire class of bugs.
Performance
- Alpha-beta pruning cuts Minimax evaluation enough to respond instantly even on low-end phones.
Lessons Learned
'Simple' games are a perfect harness for distributed-systems fundamentals: authority, reconciliation and latency.
Next case study
Consultancy CRM & Visa Platform