← Back to Guides

Tic-Tac-Toe Guide

How to never lose at three in a row

Tic-Tac-Toe: Fun Even Though the Answer's Already Known

Tic-Tac-Toe has already been fully solved mathematically: it's proven that if both sides play without a single mistake, the result is always a draw, no exceptions. And yet the game is still fun, for a simple reason: people make mistakes. Players alternate placing X and O across a 3×3 grid, racing to line up three of their own mark first, and the real skill here was never "how do I win." It's "how do I avoid mistakes, and how do I punish my opponent's."

Play Tic-Tac-Toe now →

Objective & Rules

  • Goal: Be first to line up three of your marks in a row.
  • Turn order: X moves first, then players alternate.
  • Draw: If all nine squares fill with no line, it's a tie.

Your First Move Decides Half the Game

Not every square is equal. The center touches four lines at once (two diagonals plus one row and one column), making it the single strongest opening square. Corners touch three lines each, the second-best option, and they're also the easiest squares to build a fork from. Edges (the middle of each side) touch only two lines, the weakest of the three. Opening on an edge hands over the initiative before the game even really starts.

The Only Way to Actually Win: The Fork

There's exactly one way to win Tic-Tac-Toe through skill: the fork. It's a single move that creates two different winning lines at once. Your opponent can only block one, so the other line wins automatically. The more corners you hold, the more lines you're touching simultaneously, which is exactly why corners are the second-strongest opening square.

The Never-Lose Order

Follow this checklist, in this order, on every single move, and you will never lose.

  • 1. Win if you can. Check first whether you already have two in a row with the third square open.
  • 2. Block your opponent's win. Check whether they have two in a row you need to stop.
  • 3. Build your own fork. Look for a square that sets up two winning lines at once.
  • 4. Block your opponent's fork. Check whether they have a square available that would create a fork of their own.
  • 5. Play center, then an open corner, then an open edge. If nothing more urgent is happening, follow this value order.

How Omokboard's Tic-Tac-Toe AI Plays

In AI games you play X and move first, and the AI plays O.

  • Easy picks an empty square completely at random.
  • Normal plays a random square half the time on each move. The other half, it plays a perfect move, just like Hard.
  • Hard calculates every remaining possibility all the way to the end. Tic-Tac-Toe is small enough for that, which is why the Hard AI never loses.

The trick against Normal is to keep a fork in preparation. Opening in a corner gives you more chances to build one, and since Normal plays somewhere random half the time, it often fails to stop your setup. Against Hard, practice following the defensive order above to hold the draw.

Common Mistakes

  • Opening on an edge and giving away the initiative from move one.
  • Focusing so hard on your own line that you miss your opponent's two-in-a-row.
  • Failing to spot where your opponent could build a fork and blocking the wrong square instead.

FAQ

  • Does going first guarantee an edge? Yes, X has a slight advantage, but with correct play from both sides it still ends in a draw.
  • Can I beat the Hard AI? Not in classic Tic-Tac-Toe. The classic Hard AI plays perfectly, so the best possible outcome is a draw. The Ultimate Hard AI can be beaten. Practice forks against Easy or Normal instead.
  • Is it still fun if it always ends in a draw? Against another person, mistakes happen naturally, and punishing them with a fork is exactly where the fun lives.

Ultimate Tic-Tac-Toe: Same Game, Completely Different Thinking

Once classic Tic-Tac-Toe feels completely natural, Ultimate Tic-Tac-Toe opens up a whole different kind of fun. Every square of a big 3×3 board is itself a small 3×3 Tic-Tac-Toe board, for 81 squares in total. Win three-in-a-row inside a small board and you claim that entire board; line up three claimed boards on the big grid and you win the whole game. Where the classic version can be fully calculated at a glance, Ultimate collapses fast if you're not thinking several moves ahead.

The Key Rule: Your Cell Sends Your Opponent's Next Board

Understand this one rule and everything else follows naturally: the cell you play decides which small board your opponent has to play in next. Play the "top-right cell" in any board, for example, and your opponent must play somewhere in the "top-right board" (which lights up yellow). If that board is already decided or completely full, your opponent gets an exception: they may play in any board they like. Winning three-in-a-row inside a small board claims it (a drawn small board belongs to neither side), and lining up three claimed boards on the big grid wins the whole match.

Ultimate Strategy: It's Not "Where," It's "Where You're Sending Them"

This is the single biggest shift from classic play. The real purpose of your move isn't the cell itself. It's which board that cell sends your opponent to next. Never send them somewhere they can easily win or gain an advantage. Sending them into an already-finished board is especially risky, since it hands them the freedom to play anywhere, so avoid it when you can.

The center board and the center cell within any board both stay valuable here too, since the center board touches all four lines of the big grid. Sometimes sacrificing a small board on purpose is the right call, if it keeps forcing your opponent into bad boards afterward. And don't get so absorbed in one small board that you miss a brewing two-in-a-row on the big grid. Always keep an eye on the larger picture, and always block your opponent's big-board threats.

How the Ultimate AI Plays

  • Easy picks a legal cell at random.
  • Normal plays a random cell 25% of the time and otherwise reads three moves ahead.
  • Hard reads six moves ahead, alternating its moves and yours. On turns where it may play in any board, it considers only the 12 most promising moves.

When it evaluates a position, the AI weights each spot on the big board: 4 for the center board, 3 for corner boards, and 2 for edge boards. That's the "center board matters most" principle from above, in numbers. Unlike the classic game, Ultimate has far too many possibilities to calculate to the end, so even the Hard AI isn't perfect. It can't see a plan that only pays off more than six moves out.

Ultimate FAQ

  • What happens if a small board draws? It belongs to neither player and can't be used to complete a line on the big board.
  • Why would anyone give a board away on purpose? It's an advanced tactic: sacrificing one board to keep forcing your opponent into unfavorable boards afterward.
  • What's the biggest difference from the classic version? Classic only cares about where you play. Ultimate also cares about where that move sends your opponent next.
  • Is the Ultimate Hard AI perfect too? No. It reads only six moves ahead, so it can definitely be beaten.