Tic-Tac-Toe Terminator is a computer player that uses the minimax algorithm to make its moves. This algorithm allows the A.I. to analyze the current state of the game and determine the best move to make in order to maximize its chances of winning.
The A.I. is designed to be unbeatable, meaning it will always either win or draw against a human opponent. To achieve this level of performance, the A.I. prunes unnecessary branches of the game tree to make its calculations more efficient.
- Python
- Pygame library
- Minimax algorithm
- Clone this repo
git clone git@github.com:IndieCoderMM/tictactoe-ai.git
- Install pygame library
pip install pygame
- Run the program
python main.py
Tictactoe game can also be played without engine.
- Inside tictactoe package, there are 3 modules:
board.py
: Game logicsgui.py
: Pygame interfaceengine.py
: Algorithm
- You can play the 2 player mode in the console, by running the
python tictactoe/board.py
. - You can also change the board size (4x4, 5x5, etc.). (A.I. can only play 3x3 board currently)
- By changing
MODE
inmain.py
, you can play the 2P version in pygame interface.
I welcome any and all contribution that can help me improve my project. If you have any ideas or feedback that you'd like to share, please don't hesitate to reach out.
This project is licensed under the MIT license.
If you found this project interesting or helpful, please consider giving it a ⭐.