Skip to content
← Projects

Tic-Tac-Toe AI

Web-based Tic-Tac-Toe with an unbeatable AI opponent powered by the Minimax Algorithm with Alpha-Beta Pruning.

GitHub
HTMLCSSJavaScriptMinimaxAlpha-Beta Pruning
Tic-Tac-Toe AI

Overview

A web-based Tic-Tac-Toe game with an unbeatable AI opponent — powered by the Minimax algorithm with Alpha-Beta pruning. Play optimally and the best you can do is draw.

How It Works

  • Minimax explores the full game tree, scoring terminal states (win/lose/draw) and assuming both players play optimally
  • Alpha-Beta pruning cuts branches that can't affect the outcome, making the search far more efficient
  • The AI always picks the move that maximizes its guaranteed result — so it never loses

What I Built

  • A clean, responsive game board in vanilla HTML/CSS/JS
  • The full Minimax + Alpha-Beta decision engine
  • Win/draw detection and game-state management

Tech Stack

Frontend: HTML, CSS, JavaScript

Algorithm: Minimax with Alpha-Beta pruning

Why It Matters

A hands-on implementation of adversarial game-search — the same family of algorithms behind classic game AI — built from scratch and visibly unbeatable.