A TIC-TAC-TOE game with an AI player built with the Minimax Algorithm
A console-based Tic-Tac-Toe game engine with an unbeatable AI using the Minimax algorithm.
Built with only the Python standard library. Inspired by Real Python’s tutorial.
- Console front end with human, random, and minimax (AI) players
- Pluggable game logic and clean separation of concerns
- Standard library only — no external dependencies
- Extensible for GUIs, web, or other interfaces
Clone and install the library in editable mode:
git clone https://github.com/olaholunuga/tic-tac-toe.git
cd tic-tac-toe
python3 -m venv venv
source venv\bin\activate
pip install --editable library/python -m console -X <playerX> -O <playerO>
-
human → human input from console
-
random → random move generator
-
minimax → optimal AI
# Human vs Human
python -m console -X human -O human
# Human vs Random
python -m console -X human -O random
# Human vs Minimax (AI)
python -m console -X human -O minimax
- @olaholunuga - Idea & Initial work
- Inspired by Real Python’s tutorial