Tic-Tac-Toe
Play the classic game of tic-tac-toe (noughts and crosses) against a computer that never loses, or in two-player mode against a friend on the same device. Runs in your browser.
Your turn (X)
In "vs Computer" mode the AI plays perfectly — the best you can do is a draw.
About This Tool
Tic-tac-toe — noughts and crosses — is the game almost everyone learns as a child, and it hides a neat lesson in game theory: with perfect play by both sides, it always ends in a draw. This version lets you test that against an AI that never makes a mistake.
The rules
Two players take turns marking squares on a 3×3 grid, X and O. The first to line up three of their marks in a row — horizontally, vertically, or diagonally — wins. If all nine squares fill without a line, it's a draw.
Why you can't beat the computer
The "vs Computer" mode uses the **minimax algorithm**: at every move the AI looks ahead through all possible continuations and chooses the one that guarantees the best worst-case outcome. Because tic-tac-toe is small enough to solve completely, minimax plays perfectly. The best you can achieve is a draw — and only if you also play perfectly.
Tips for not losing
- Open in the **center or a corner**; the center touches four winning lines. - Always **block** your opponent's two-in-a-row immediately. - Look for a **fork** — a move that creates two threats at once, which your opponent can't block both of.
Switch to two-player mode to play a friend on the same device. Everything runs in your browser.
Frequently Asked Questions
Related Tools
Last updated: August 8, 2026