Tic Tac Toe (Minimax AI) — Aritro Saha Arcade

Challenge an unbeatable algorithmic artificial intelligence in classic 3x3 Tic Tac Toe powered by the Minimax decision tree algorithm.

Game Overview & AI Decision Engine

This implementation features a recursive Minimax search tree that evaluates all future board states to depth 9. At hard difficulty, the AI plays mathematically optimal moves with alpha-beta pruning, guaranteeing either an AI victory or a forced draw.

Minimax Game Tree & Mathematical Unbeatability

The core artificial intelligence is built on rigorous game theory:

  • Zero-Sum Recursive Evaluation: The algorithm simulates every legal move recursively down to terminal game states. Wins for the AI return a positive heuristic score (+10), player wins return negative (-10), and draws return 0.
  • Depth-Discounted Heuristics: Heuristic values are adjusted by search depth (e.g. +10 - depth), ensuring the AI prioritizes immediate victories over prolonged wins and delays losses as long as possible.
  • Mathematical Guarantee: In game theory, Tic Tac Toe is a solved zero-sum game with perfect information. A complete Minimax traversal proves that an opponent playing against optimal moves can never achieve victory.
  • Tiered Difficulty: Easy mode selects random legal positions, Medium introduces probabilistic mistakes, and Hard executes pure Minimax optimization.

Controls

Click or tap any available cell to place your X token. The AI responds within milliseconds.

Frequently Asked Questions

Is the Hard AI in Tic Tac Toe truly unbeatable?

Yes. Because 3x3 Tic Tac Toe is a mathematically solved zero-sum game, the Minimax algorithm guarantees that optimal play will always result in an AI victory or a draw.

How does the Minimax algorithm make decisions?

It recursively evaluates all legal moves down to terminal outcomes, assigning positive scores to AI wins and negative scores to player wins while depth-penalizing longer paths.