{{ winner }} wins!
Draw
Current Player – {{ currentPlayer }}

Introduction:

Tic-tac-toe, sometimes called noughts and crosses, is a two-player placement game where X and O marks compete to align three symbols on a three-by-three grid. Despite its simplicity, the pastime illustrates combinatorial search, optimal strategy, and inevitable stalemate when both sides play perfectly.

The interactive engine presents nine equal squares. You click an empty cell to place your mark; the opposing side is either a second person or a deterministic, unbeaten algorithm that chooses its optimal counter-move. Each turn recalculates victory patterns, signals draws, and—even mid-game—encodes the full position inside a shareable URL.

Use the tool to settle brief challenges, introduce children to basic game theory, or sharpen opening tactics between meetings. Because every calculation runs locally and no session data leaves your browser, you can bookmark or send positions without exposing personal information.

Features:

  • Unbeaten AI opponent driven by depth-limited minimax search.
  • Optional second-human mode for local multiplayer.
  • Shareable links preserve board state and opponent choice.
  • Animated highlight flashes along any winning line.
  • Responsive layout scales gracefully from phones to widescreens.

Step-by-Step Guide:

Follow these steps to start a round and record or replay positions.

  1. Select an Opponent—either the computer or a second human.
  2. Note the “Current Player” indicator at the top of the board.
  3. Tap any vacant square to place your symbol and trigger the next turn.
  4. Continue until either side aligns three marks or all squares fill.
  5. Click Reset Game to clear the board, or bookmark the page to revisit the current position.

FAQ:

How strong is the computer?

The algorithm evaluates every legal continuation, ensuring it never loses and usually forces a draw against perfect play.

Can I undo a move?

No. The minimalist design encourages forward play; use the reset button if you wish to restart the round.

Will the game work offline?

Yes. After the initial page load, all logic executes within your browser, so subsequent play requires no network connection.

Is my data stored?

No data ever leaves your device; the current board position lives only in the link you optionally share.

What happens on a draw?

When all nine squares fill without a winner, the engine announces a draw and offers an immediate restart.

Glossary:

Algorithm
Step-by-step procedure for solving a problem.
Draw
Game ending without a winner.
Grid
Three-by-three board of playable cells.
Mark
Symbol (X or O) placed by a player.
Minimax
Decision rule that minimises a loss in worst-case play.

No data is transmitted or stored server-side.