Minimax Tic-Tac-Toe

How to Play

This is a classic game where two players take turns marking squares in a 3x3 grid. The goal is to get three of your marks in a row, either horizontally, vertically, or diagonally, before your opponent.

You are X, and the AI is O. Click any empty square to make your move. The AI uses the Minimax algorithm to find the optimal move.

Step-by-step Minimax
  • Enable "Step-by-step Minimax" to pause the AI's analysis after your turn.
  • Next step: Reveals the next move the AI evaluates.
  • Play move: Skips the analysis and executes the AI's best move.
Your turn (X)
X = You O = AI AI uses minimax

AI Search Trace

How to Read the Search Trace

  • The trace shows the AI's thought process.
  • Depth: How many moves the AI is thinking ahead.
  • MAX (AI): The AI is trying to get the highest score.
  • MIN (Human): The AI assumes you will try to get the lowest score.
  • The final score determines the AI's chosen move.

Minimax Tree

How to Read the Tree

Hover over a node in the tree to highlight the corresponding square on the Tic-Tac-Toe board.

  • The tree visualizes the game possibilities explored by the AI.
  • Each node is a potential move with its calculated score.
  • MAX nodes: Moves where the AI is trying to maximize its score.
  • MIN nodes: Moves where the AI anticipates you will try to minimize its score.