⭕ Tic Tac Toe
Play tic tac toe against a friend or a computer opponent with easy, medium and unbeatable hard difficulty.
Game Mode
Difficulty
You play as
Draw
ties
How to play
Take turns placing your mark on an empty square by clicking it.
Get three in a row — horizontally, vertically, or diagonally — to win.
In vs Computer mode: Easy is random, Medium is smart, Hard is unbeatable.
Hard uses the Minimax algorithm. Your best result against it is a draw!
Related Tools
Memory Match Game
Flip and match emoji card pairs across three grid sizes and eight themes, with move counter, timer and star rating.
Word Scramble
Scramble text letter by letter with three modes, including one that keeps each word's first and last letter in place.
Number Guessing Game
Guess a hidden number using higher and lower hints, with easy, medium, hard and fully custom difficulty settings.
decision maker wheel game
Add your options, spin the wheel, and let an even-chance draw settle a small decision for you.
How the computer opponent chooses its move
Medium plays strategically most of the time but deliberately chooses at random on roughly three moves in ten. That injected randomness is what makes it beatable: it will usually take a win and usually block yours, but not always, so games stay competitive rather than grinding to inevitable draws.
Hard runs minimax with alpha-beta pruning. Minimax explores the full game tree from the current position, assuming the computer maximises its own score and that you play to minimise it, scoring a win, a draw and a loss at the terminal positions and propagating those values back up. Alpha-beta pruning discards branches that cannot affect the final choice, which makes the search fast enough to be instantaneous on a nine-square board. Because tic tac toe is a solved game, perfect play always ends in a draw, so a hard opponent never loses. A short delay is added before it moves, so the reply does not appear instantly.
Worked example: why the centre and corners matter
The centre square sits on four lines, its row, its column and both diagonals. Each corner sits on three: a row, a column and one diagonal. Each edge square sits on only two. So the centre is worth twice as much as an edge by that measure, and it is why an opening move to the centre is the strongest available.
Here is a concrete trap. You take the centre as X. The computer replies on an edge rather than a corner. You then take a corner, threatening a line through the centre. The opponent must block. You take a second corner that sits on a different line also running through your centre, and you now have two separate threats in one move. Only one can be blocked, so your next move wins.
Against the hard opponent that sequence never gets started, because minimax sees the fork several moves ahead and answers your centre opening with a corner, which is the only reply that holds the draw.
Reading the scoreboard and playing to a draw
If you are losing to medium, the fix is almost always to stop chasing your own line and start watching the opponent's. Before every move, check whether they have two in a line with the third square empty, and block it. Only when there is no immediate threat should you build your own.
The two openings worth learning are centre and corner. If you move first and take the centre, the only reply that draws is a corner. If you take a corner first, the only reply that draws is the centre. Anything else loses against accurate play.
Two-player mode adds no computer logic: it alternates turns and checks the eight winning lines after each move, so spotting threats is up to the players.