A modular Gomoku (Five in a Row) ecosystem featuring a dynamic web interface and two independent AI engines powered by Python and C#.
GomokuAI is designed with a strict decoupled architecture. The project separates the game logic and user interface from the decision-making engines. This modularity allows any component—whether the UI or an AI engine—to be modified or replaced without affecting the rest of the system.
The application consists of three distinct pillars that communicate via REST APIs:
- Web Interface: The central hub managing game rules and state.
- Python AI: An engine utilizing a Flask-based API.
- C# AI: An engine utilizing a .NET-based API.
The interface sends the current board state via an API request. The selected AI processes the move and returns the optimal coordinates through its entry point.
- HTML5 / CSS3: For a responsive and dynamic board display.
- JavaScript (Vanilla): Divided into specialized modules handling:
- Gomoku game logic and win conditions.
- Turn management and session state.
- Application settings and API query handling.
Both AI engines share a similar logic structure to ensure consistent competitive levels, despite being written in different languages:
- Minimax Algorithm: Used to explore the decision tree and anticipate future moves.
- Heuristic Evaluation Function: Scores specific board positions to determine the best strategic path.
- APIs: Flask for the Python implementation and ASP.NET Core for the C# implementation.
- Independence: Swap between the Python and C# AI mid-game to compare performance.
- Performance: Optimized evaluation functions designed for classic, reliable strategic gameplay.
- Scalability: The API-first approach makes it easy to plug in new AI models (e.g., Deep Learning) in the future.
This project successfully met and exceeded all initial requirements. By applying established concepts such as Minimax and heuristic scoring—previously explored in Chess and Connect Four projects—this implementation focuses on high-quality code separation and robust inter-service communication.
- Clone the repository
git clone https://github.com/Aitaneuh/gomokuAI.git
cd gomokuAI- Setup the Backend
cd python
pip install flask
python server.pycd csharp
dotnet run- Launch the Web Interface
Open
index.htmlin your browser.
