Tic Tac Toe
Play Tic Tac Toe against a computer opponent with Easy, Medium, and Unbeatable difficulty, powered by the minimax algorithm. Runs entirely in your browser.
🔒 This tool runs entirely in your browser. Your files are never uploaded to a server.
Your turn — you're X.
How it works
- Choose a mode — Vs computer or 2 players (pass-and-play on one device).
- Against the computer, pick a difficulty (Easy, Medium, or Unbeatable) and whether you play X and move first or O and move second.
- Click any empty square to place your mark. Get three in a row, column, or diagonal to win — the winning line lights up.
- Optionally tap the speaker button to turn on move and win sounds. It's off by default and your choice is remembered.
- The running You / Draws / AI (or X / Draws / O) score is saved in your browser between visits. Press New game to replay, or Reset score to clear the tally.
How the AI decides its move
The Unbeatable AI uses minimax — for every possible move, it plays out the rest of the game to the end assuming both sides play perfectly, and scores each resulting outcome:
score = 10 − depth (AI win) | depth − 10 (your win) | 0 (draw)
Subtracting the depth (the number of moves already played) makes the AI prefer a quick win over a slow one, and a slow loss over a fast one, if losing is unavoidable. It then picks a move with the highest score — and chooses at random among moves that tie, so it isn't predictable. The engine is symmetric, so it plays just as optimally as O responding to you or as X opening the game: since tic-tac-toe is small enough to fully solve this way, an Unbeatable move is always at least as good as a draw. Easy and Medium use the same engine but occasionally swap the optimal move for a random legal one — about 80% of the time on Easy, 40% on Medium — which is what makes them beatable.
FAQ
Can I play Tic Tac Toe with a friend on the same device?
Yes. Switch the mode dropdown to "2 players" and the AI steps out — you and a friend take turns tapping the board on the same screen, X then O, with a shared scoreboard.
Can I actually beat the Unbeatable AI?
No — on Unbeatable, the AI always plays a mathematically optimal move, so it can never lose whether it's X or O. The best you can force is a draw, and only if you also play every move perfectly.
Can I play as O instead of X?
Yes. In vs-computer mode, pick "Play as O (second)" and the computer opens as X. The minimax engine is symmetric, so it stays unbeatable playing either side.
What's the difference between Easy and Medium?
Both occasionally play a random move instead of the optimal one — Easy makes a mistake on most of its turns, Medium on fewer. Easy is beatable quickly; Medium takes more careful play.
Is my score saved?
Your win / draw / loss tally is stored in your browser (localStorage), so it survives a page reload. Nothing is sent anywhere — press "Reset score" to clear it. Individual games are not recorded.
Does this Tic Tac Toe game have sound?
Yes, and it's off by default. Tap the speaker button to switch on short move and win tones — generated in the browser with the Web Audio API, no downloads. Your choice is remembered.
Why does the AI pause before moving?
That's just a short delay so its move doesn't feel instant — solving a 3x3 board is effectively immediate, so the pause is purely for pacing.
How we compare
| Feature | Ceyentra Web Tools | playtictactoe.org | tictactoefree.com | toytheater.com |
|---|---|---|---|---|
| Unbeatable AI, verified against the full game tree | ✓ | Strength not stated | "Expert" mode | ✗ |
| Adjustable difficulty levels | ✓ 3 | ✗ | ✓ 4 | ✗ |
| Choose to play as X or O | ✓ | ✗ | ✓ | ✗ |
| 2-player pass-and-play on one device | ✓ | ✓ | ✓ | ✓ |
| Score saved between visits | ✓ | In-session only | In-session only | Not shown |
| Sound you can turn off — silent by default | ✓ | No sound | Mute button | Mute button |
| No sign-up, no download | ✓ | ✓ | ✓ | ✓ |
| Embeddable on your own site (iframe) | ✓ | ✗ | ✗ | ✗ |
Pick a fight you can win — Easy or Medium when you want a quick round, Unbeatable when you want a real one — or drop the AI entirely and hand the device to a friend. Your score follows you back next visit, and there's nothing to install, sign up for, or mute on the way in.