Tic-Tac-Toe

About the game

Tic-Tac-Toe is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a diagonal, horizontal, or vertical row is the winner.

Games played on three-in-a-row boards can be traced back to ancient Egypt, where such game boards have been found on roofing tiles dating from around 1300 BC. An early variation of tic-tac-toe was played in the Roman Empire, around the first century BC. It was called terni lapilli (three pebbles at a time) and instead of having any number of pieces, each player only had three, thus they had to move them around to empty spaces to keep playing.

Creating a Tic-Tac-Toe Script

Easily create your Tic-Tac-Toe script that will go toe-to-toe with the Codecraft script or put it up against others in the Arena. Using our browser-based code editor, run your code and see the results instantly!

Sign In To Create a New Script

Tic-Tac-Toe Basic Rules

  1. The game is played on a grid that's 3 squares by 3 squares.
  2. You are X, your friend (or the computer in this case) is O. Players take turns putting their marks in empty squares.
  3. The first player to get 3 of their marks in a row (up, down, across, or diagonally) is the winner.
  4. When all 9 squares are full, the game is over. If no player has 3 marks in a row, the game ends in a tie.