Tic-Tac-Toe
A browser-based Tic-Tac-Toe game built with HTML, CSS, and JavaScript, featuring single-player AI and two-player modes.
Duration
Sep 2023
Team Size
1 people
Technologies
3+ tech

Project Overview
A web-based Tic-Tac-Toe game developed with vanilla HTML, CSS, and JavaScript. The game supports both single-player mode against an AI opponent and local two-player mode. The AI uses the minimax algorithm to play optimally, with difficulty levels adjusting the search depth. A save and load feature persists game state to localStorage so players can resume at any time.
Features
- ✓Classic Tic-Tac-Toe gameplay with a clean, intuitive interface
- ✓Single-player mode against an AI opponent using the minimax algorithm
- ✓Two-player mode for competitive local play
- ✓Multiple AI difficulty levels to suit all players
- ✓Save and load game functionality via localStorage for resuming play
Challenges
- •Implementing a minimax AI that plays optimally in vanilla JavaScript
- •Designing a difficulty system that feels meaningfully different across levels
- •Persisting game state to localStorage cleanly without a backend
Solution
Implemented minimax with alpha-beta pruning for the AI. Difficulty levels reduce the AI's search depth to introduce imperfection at lower settings. Game state is serialized to JSON and stored in localStorage on every move.
Architecture
Single-page vanilla JavaScript application. Game state is managed in a plain JS object. DOM manipulation updates the board after every move. localStorage handles persistence. GitHub Pages hosts the live demo.
Results & Impact
- ✓Live demo playable directly in the browser via GitHub Pages
- ✓Minimax AI is unbeatable at maximum difficulty
- ✓Save/load feature works entirely client-side with no backend required
Frontend
Backend
Database
Tools
- Ismail ZAHIR
Free to use, modify, and distribute with attribution.
More Projects

