A terminal-based Gomoku game with a configurable Minimax AI.
This is a Python implementation of the classic Gomoku (Five in a Row) game. It supports both human vs human and human vs AI modes with configurable AI search depth.
The AI combines Minimax with alpha-beta pruning, pattern-based evaluation, candidate-move filtering, and transposition-table caching.
- 15×15 terminal board
- Human vs Human and Human vs AI gameplay
- Configurable AI search depth
- Automatic win condition detection
- Python 3.12 or later
-
Clone the repository:
git clone https://github.com/Leon-coder-prog/Gomoku.git
-
Change into the project directory:
cd Gomoku -
Run the game:
python main.py
If not working:
python3 main.py
When the program starts you will see a menu:
- Enter a or b to play Human vs Human or Human vs AI
If you choose to play with AI, you will need to:
-
Choose an AI depth (1 to 3 is recommended).
Depths greater than 3 require confirmation and significantly increase CPU usage and running time.
-
Choose your side (Black or White)
During the game, enter moves in the format:
a3
- The letter represents the column (a to o)
- The number represents the row (1 to 15)
A player wins when they get 5 of their pieces in a row in any direction: horizontal, vertical, or diagonal.
.
├── main.py # Main program
├── board.py # Board display logic
├── ai.py # AI logic
├── assets/ # Project images and assets
└── README.md # This file
This project is licensed under the MIT License. See the LICENSE file for details.
