A command-line (unbeatable) Tic Tac Toe AI game implemented in Rust. This project offers multiple game play modes, including AI algorithms like Minimax and Monte Carlo Tree Search (MCTS).
Section | Description |
---|---|
Features | Overview of game modes and AI |
Installation | How to install and run the game |
Game Modes | Explanation of different game modes |
AI Algorithms | Summary of Minimax & MCTS |
Gallery | Screenshot of the game |
Resources | Useful links for AI learning |
Contact | Get in touch with the developer |
- ✔ Multiplayer: Play against another human.
- ✔ Basic Bot: Bot plays immediate wins.
- ✔ Minimax AI: Uses the Minimax algorithm to play optimally.
- ✔ MCTS AI: Uses Monte Carlo Tree Search for decision-making.
Clone the repository and build the project:
git clone https://github.com/0xTijan/tic-tac-toe-ai.git
cd tic-tac-toe-ai
cargo build
Run the game:
cargo run
Two players take turns on the same terminal.
The bot takes opportunities for immediate wins and blocks the opponent's immediate wins; otherwise, it plays randomly.
A strategy-based AI that always plays optimally by evaluating the best possible move using the Minimax algorithm.
An AI that uses Monte Carlo simulations to determine the best move. It balances exploration and exploitation to refine its strategy.
The Minimax algorithm evaluates all possible moves, selecting the one that maximizes the AI’s chance of winning while minimizing the opponent’s best options. It guarantees perfect play but can be computationally expensive.
👉 Full explanation in ./minimax.md.
Unlike Minimax, MCTS uses simulations to statistically determine the best move, making it effective for large game spaces.
👉 Full breakdown in ./mcts.md.
- MCTS Visualization - great for debugging
- MCTS explanation (YouTube)
For questions or suggestions, reach out via GitHub or email at tijan@tijan.dev or visit my website.