❌ Tic-Tac-Toe

You are X. Get three in a row before the computer does — or play a friend on the same device.

Loading game…

About Tic-Tac-Toe

Tic-Tac-Toe is the three-in-a-row game most people learn as children, played here on a 3x3 grid. You can face a computer opponent on Easy or Hard, or switch to two-player mode and pass the device back and forth with a friend.

How to play

  • The board is a 3x3 grid. X always moves first, and against the computer you are always X.
  • Players take turns marking one empty square each.
  • The first player to get three of their marks in a row, column or diagonal wins, and the winning line is highlighted.
  • If all nine squares fill up with no line of three, the game is a draw.
  • The score bar keeps a running tally of X wins, O wins and draws. Changing the mode resets the tally and starts a new game.
  • Your Best score is the highest number of X wins you have reached in a single run against the computer; two-player games do not count towards it.

Controls

  • Click or tap an empty square to place your mark.
  • Use the drop-down menu above the board to choose Easy, Hard or 2 players.
  • Every square is a normal button, so you can also move between squares with Tab and place a mark with Enter or Space.
  • When a game ends, press Play again to clear the board.

Tips and strategy

  • Against Hard, aim for a draw. The computer searches every possible continuation, so it never loses; a draw is the best result available.
  • Open in a corner. It gives the opponent the most chances to go wrong, and on Easy it often leads to a fork.
  • A fork is a move that creates two threats at once. Your opponent can only block one, so look for squares that sit on two of your open lines.
  • If your opponent takes a corner first, answer in the centre. Answering with an edge square loses against correct play.
  • Always check for an immediate win before blocking, and always block an immediate threat before doing anything else.

Background

Three-in-a-row games on small grids are very old, and the modern pencil-and-paper version is known in British English as noughts and crosses. Because the game is so small, it was one of the first to be played by a computer: in 1952 A. S. Douglas wrote OXO, a noughts and crosses program for the EDSAC computer at the University of Cambridge. It is also a classic first example in game theory, since every position can be analysed completely; with perfect play from both sides the result is always a draw.

Questions

How strong is the computer?
On Hard it uses a full minimax search of the game tree and plays perfectly, so you can draw but never beat it. On Easy, each move has a 50 percent chance of being a random empty square instead of the best one, which gives you real chances to win.
Can I play against a friend?
Yes. Choose 2 players from the menu and take turns on the same device. X still moves first.
Who goes first in the next game?
X always starts, so against the computer you make the first move every game.
Advertisement

More games