https://github.com/indiecodermm/tictactoe-ai
Unbeatable Tic-tac-toe A.I. can calculate the best moves using Minimax algorithm. Built in Python using Pygame library.
https://github.com/indiecodermm/tictactoe-ai
minimax-algorithm pygame tic-tac-toe tictactoe-ai
Last synced: about 2 months ago
JSON representation
Unbeatable Tic-tac-toe A.I. can calculate the best moves using Minimax algorithm. Built in Python using Pygame library.
- Host: GitHub
- URL: https://github.com/indiecodermm/tictactoe-ai
- Owner: IndieCoderMM
- License: mit
- Created: 2022-06-14T10:42:12.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-24T17:52:38.000Z (over 2 years ago)
- Last Synced: 2025-03-26T22:36:36.341Z (2 months ago)
- Topics: minimax-algorithm, pygame, tic-tac-toe, tictactoe-ai
- Language: Python
- Homepage:
- Size: 2.75 MB
- Stars: 10
- Watchers: 1
- Forks: 48
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://github.com/IndieCoderMM/tictactoe-ai/network/members)

[](https://github.com/IndieCoderMM/tictactoe-ai/blob/master/LICENSE)## Table of Contents
- [🤖 Tic-Tac-Toe Terminator](#-tic-tac-toe-terminator)
- [🛠 Technology](#-technology)
- [📸 Screenshots](#-screenshots)
- [💾 Installation](#-installation)
- [🎮 Tictactoe](#-tictactoe)
- [🤝 Contributing](#-contributing)
- [📜 License](#-license)
- [💖 Show your support](#-show-your-support)# 🤖 Tic-Tac-Toe Terminator
**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.
## 🛠 Technology
- Python
- Pygame library
- Minimax algorithm## 📸 Screenshots
## 💾 Installation
1. Clone this repo
```sh
git clone [email protected]:IndieCoderMM/tictactoe-ai.git
```2. Install pygame library
```sh
pip install pygame
```3. Run the program
```sh
python main.py
```## 🎮 Tictactoe
**Tictactoe** game can also be played without engine.
- Inside **tictactoe** package, there are 3 modules:
1. `board.py`: Game logics
2. `gui.py`: Pygame interface
3. `engine.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` in `main.py`, you can play the 2P version in pygame interface.
## 🤝 Contributing
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.
## 📜 License
This project is licensed under the [MIT](./LICENSE) license.
## 💖 Show your support
If you found this project interesting or helpful, please consider giving it a ⭐.