Skip to content

Repository files navigation

🧠 UltimateTicTacAI

An AI Agent for Ultimate Tic Tac Toe, developed using Monte Carlo Tree Search (MCTS) and Alpha-Beta Pruning algorithms.


🚀 Play Now (Web UI)

Try the AI directly in your browser without installing anything!
👉 https://shinnei.github.io/UltimaTTT-Agent/

The web version is fully serverless, running Python natively in your browser using Pyodide and Web Workers.


📌 Project Overview

This project is part of the Introduction to AI course (Semester 241) at HCMUT, where each group was required to build an AI agent that competes in a round-robin tournament playing Ultimate Tic Tac Toe.

Our goal was to explore and compare different decision-making techniques in adversarial games by implementing:

  • MCTS – a search-based AI using simulations and playouts.
  • Alpha-Beta Pruning – a classic adversarial search algorithm with custom evaluation functions.

📖 Game Rules

For English readers, please refer to Wikipedia for an overview of the game mechanics:
🔗 https://en.wikipedia.org/wiki/Ultimate_tic-tac-toe


🗂 What's in the Repo?

  • state.py — Core logic for handling the Ultimate Tic Tac Toe board and rules.
  • test_game.py — Entry point for running and visualizing AI matches.
  • Alpha_Beta.py — Alpha-Beta Pruning-based AI agent with heuristic evaluations.
  • MCTS.py — MCTS-based AI agent.
  • index.html, style.css, script.js, worker.js — Frontend and Pyodide Web Worker files for the browser-based UI.

▶️ How to Run Locally

If you prefer running the code locally, there are multiple ways:

1. Web Version (Local Server)

python -m http.server 8000

Then navigate to http://localhost:8000/index.html.

2. Python Script

Use the main() function in main.py or run test_game.py to simulate a match between two agents in the terminal.


📬 Contact Info

About

An AI Agent for Ultimate Tic Tac Toe, developed using Monte Carlo Tree Search (MCTS) and Alpha-Beta Pruning algorithms.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages