Songtov Utility
Back to Home
Games

Tic-Tac-Toe

Two players — X (blue) vs O (purple). First to line up three wins.

Next player: X

The rules, in one paragraph

Tic-Tac-Toe is played on a 3×3 grid. Two players take turns marking empty cells with their symbol — X for the first player, O for the second. The first player to place three of their marks in a horizontal, vertical, or diagonal row wins. If all nine cells fill without either player making a line, the game ends in a draw.

How to play this version

  1. Player X moves first — click or tap any empty cell to place an X.
  2. Player O moves next. The status line above the board always shows whose turn it is.
  3. The game ends automatically the moment a winning line appears (it gets highlighted) or the board fills.
  4. Click New Game to reset and start again with X.

Why Tic-Tac-Toe matters beyond the playground

Tic-Tac-Toe is probably the simplest non-trivial game in existence — small enough that the entire game tree, about 255,168 possible games, fits on a napkin if you squint. Precisely because it is so small, it is one of the first games a student of game theory, minimax search, or reinforcement learning solves. Knowing the full game cold does not make you better at chess, but it does build intuition for the kinds of problems every board game eventually becomes.

Strategy in three sentences

If both players play optimally, Tic-Tac-Toe always ends in a draw. The first player’s best opening is a corner; the second player must respond with the center, otherwise the first player can force a win. From there, the optimal strategy reduces to a short priority list: win if you can, block if you must, otherwise create a "fork" — a position with two simultaneous winning threats.

For the full walkthrough, including every response tree and the famous two-fork traps, see the strategy guide linked below.

Common use cases

  • A quick break with a friend during a lunch meeting.
  • Teaching a child the basics of turn-based games and strategy.
  • A warmup exercise when learning a new programming language — writing a Tic-Tac-Toe solver is the classic first project.
  • Demonstrating minimax or alpha-beta pruning in a computer-science class.

Frequently asked questions

How many players does this support?

Two players share the same device and alternate turns. X always goes first. There is no AI opponent in this version — it is the classic hotseat format.

How does the game decide a winner?

After every move the board is checked against the eight winning lines (three rows, three columns, two diagonals). If any line contains the same player in all three cells, that player wins and the winning line is highlighted.

What counts as a draw?

If all nine cells are filled and no player has completed a line, the game ends in a draw. With perfect play from both sides, every Tic-Tac-Toe game ends in a draw — that is the whole point of the strategy below.

Can I play with just keyboard controls?

Not currently — the board uses mouse or touch input only. On mobile, tap an empty cell. On desktop, click it.

Does the game save progress?

No. The board exists only in the current tab. Refreshing the page starts a new game.

Related reading