How does a computer play a game perfectly? It imagines every possible future, scores the endings, and assumes both sides play their best. One player (MAX) tries to maximise the score; the other (MIN) tries to minimise it. That single idea — minimax — makes tic-tac-toe unbeatable, and underlies how chess and Go engines think. Play below, then watch the AI's reasoning bubble up its game tree.
You're X; the computer is O and uses minimax, so it explores the whole game tree before every move. Try your hardest — the best you can ever get is a draw. After the AI moves, hit Show tree to watch it score each ending (+1 AI win, 0 draw, −1 AI loss) and propagate values upward to justify its choice.
Minimax is correct but wasteful: it visits every leaf. Alpha–beta pruning keeps the same result while skipping whole branches it can prove won't change the outcome — once a move is found that the other player would never allow, its remaining siblings are abandoned (greyed out). Press Run to watch values bubble up and pruned subtrees vanish, and compare the node counts. Increase depth or branching to feel the game-tree explosion that makes pruning essential.
Minimax assumes a zero-sum, perfect-information game: what's good for one player is exactly bad for the other, and nothing is hidden (no dice, no secret cards). Tic-tac-toe, chess, checkers, and Go all qualify.
So why can't we just solve chess? Its game tree has on the order of 10120 paths — astronomically more than there are atoms in the observable universe. Engines can't reach the leaves, so they stop early and replace the true win/draw/loss with a heuristic (an evaluation of material, king safety, space…). Chess and Go programs are minimax with alpha-beta plus a clever guess at the bottom — and, for Go, neural-network evaluation guiding the search. The core idea you watched is exactly the same.