Tic-Tac-Toe
Two players, or play against an unbeatable computer.
Classic Tic-Tac-Toe — play locally against a friend, or against the computer on Easy, Medium or Unbeatable difficulty. Tracks the score across rounds and works full-screen on mobile.
Rules
- Two players take turns placing their mark — X or O — in an empty square of a 3 × 3 grid. X always goes first.
- The first to get three in a row — across, down or diagonally — wins.
- If all nine squares are filled without a winner, it's a draw.
Strategy to win (or never lose)
- Win if you can: if you have two in a row with an empty third square, take it.
- Block if you must: if your opponent has two in a row, block the third square.
- Create a fork: make a move that sets up two ways to win at once. Your opponent can block only one.
- Take the center if it's free — it's part of four possible lines, more than any other square.
- Then take a corner, preferably opposite one your opponent holds. Corners are part of three lines; edges only two.
A classic trap
As X, start in a corner. If O answers anywhere except the center, X can usually force a win by taking another corner and setting up a fork. That's why the safest reply to a corner opening is always the center.
Why it always ends in a draw
Tic-tac-toe is a "solved" game: there are 255,168 possible games, and if both players make the best move every time, every one of them ends in a draw. That's exactly what the Unbeatable mode does — it checks every possible future move with the minimax algorithm, so the best you can do is draw. Medium mode always blocks an obvious win but can be caught by a fork, which makes it the best place to practice that trap; Easy mode picks random moves.
Frequently asked questions
Can I play against a friend on the same device?
Yes — that's the default mode. Pass the device back and forth; X always goes first.
How good is the "Unbeatable" computer opponent?
It uses the minimax algorithm to always play the mathematically optimal move — it can't be beaten, only drawn, no matter how you play. "Medium" always takes a win and blocks yours, but only plays perfectly about half the time, so you can beat it with a fork. "Easy" picks random moves.
Is my score saved?
Yes — wins, losses, and draws are kept in your browser (not on any server) so the score persists between visits until you reset it.
Does this work on mobile?
Yes — tap to place a mark, and the fullscreen button expands the board to fill your screen, which works well on a phone.
Who should go first?
Going first gives X a small advantage, because X gets five of the nine squares in a full game. Many players alternate who starts each round to keep it fair.