Tic-Tac-Toe

You are X, the computer is O. Get three in a row.

Your move

How to play

Take turns placing marks on a 3 × 3 grid. The first to get three in a row, across, down, or diagonally, wins. If the grid fills up with no line, it is a draw. Your wins, losses, and draws are tallied in this browser.

ActionControls
Place your XClick or tap a square
Start againThe New game button

How the computer plays

On each turn the computer takes a winning square if it has one, blocks you if you are about to win, and otherwise takes the center, then a corner. It doesn’t plan ahead beyond that, which is how you can beat it.

How to win: the fork

A fork is a move that creates two ways to win at once. The computer can block only one, so you win on the next move. Against this computer, one line works every time: take a corner, and when it takes the center, take the opposite corner. It answers with another corner, which forces you to block, and that block gives you two winning lines at once.

Why perfect play is a draw

Tic-tac-toe is a solved game: if both players play perfectly, every game is a draw. The center square is part of four possible lines, the corners three each, and the edges only two, which is why center and corners are the strongest squares. Because the whole game can be worked out by hand, it is often the first example used to teach how computer opponents search ahead.