A modern, responsive Tic Tac Toe game built with HTML, CSS, and Vanilla JavaScript.
Play in:
- 👥 Pass-N-Play (PvP) mode
- 🤖 Bot Mode (Play against AI)
Game history is saved locally using localStorage and displayed in a structured table format.
- 🎨 Clean UI with SVG-based board
- 🔄 Restart anytime
- 📜 Game history tracking (separate for PvP & Bot)
- 💾 Persistent history using
localStorage - 📅 Stores structured JSON (result, mode, timestamp)
- 📊 Displays history in a scrollable table
- 📱 Fully responsive layout
- 🔤 Modern typography using Inter font
- Dynamic SVG board
- Turn indicator styling
- Scrollable history with date & time
- Active mode switching
tic-tac-toe/
│
├── index.html
├── style.css
├── script.js
└── README.md
- Clone or download this repository
- Open
index.htmlin your browser
No build tools. No dependencies. Just open and play.
startGame('pvp')→ Pass-N-PlaystartGame('bot')→ Play with Bot
Game results are stored as structured JSON:
{
"result": "player",
"mode": "bot",
"timestamp": "2026-02-13T14:25:31.123Z"
}Each mode uses a separate key in localStorage:
TTT_PVP_HISTORYTTT_BOT_HISTORY
History is limited to the most recent 100 games.
The table displays:
| Result | Date | Time |
|---|
- Invalid or corrupted entries are automatically skipped.
- Empty history shows:
No history yet.
- Scrollable table wrapper with sticky header
- Active mode toggle button
- Clean button system
- Mobile-friendly design
- 🧠 Smarter AI (Minimax algorithm)
- 📈 Win statistics summary
- 🎨 Win/Loss color indicators
- 🗑 Clear history button
- 💾 Export history to JSON
- 🌙 Dark mode toggle
- 🔊 Sound effects
- HTML5
- CSS3
- Vanilla JavaScript
- SVG
- localStorage API
Free to use and modify for learning or personal projects.