Tic-Tac-Toe

Take turns placing X and O on a 3 × 3 grid. The first player to get three in a row, across, down or diagonally, wins the round. Play the computer or pass the device to a friend.

Your move. You are X.

How to play Tic-Tac-Toe

Two players, X and O, take turns marking an empty square on a 3 × 3 grid. The first to place three of their marks in a horizontal, vertical or diagonal line wins. If all nine squares fill up without a line, the round is a draw. In this version the players swap who moves first after every round, and the scoreboard keeps a running total.

Game modes

  • vs Computer, Unbeatable: the computer looks ahead at every possible move using the minimax algorithm. It never loses. The best you can do is a draw, which is a good test of your defence.
  • vs Computer, Easy: the computer often picks a random square, so you can practise setting up wins.
  • 2 players: share one device and take turns.

Winning strategy

  • Start in a corner. When you move first, a corner gives your opponent the most chances to go wrong. If they answer anywhere except the centre, you can usually force a win.
  • Create a fork. A fork is a move that threatens two lines at once. Your opponent can only block one, so you win with the other.
  • Block forks before they happen. When your opponent holds two opposite corners and you hold the centre, play an edge square, not a corner.
  • Take the centre if it is free. The centre is part of four possible lines, more than any other square.

Fun fact

There are 255,168 possible games of tic-tac-toe, but with perfect play from both sides every game ends in a draw. That makes it a great first example of game theory and a classic exercise for anyone learning to program.