Java Implementation with Search-Oriented Architecture
Gomoku is a two-player board game where players alternate placing stones on a grid, aiming to align five consecutive pieces horizontally, vertically, or diagonally.
The project models the game as a sequential, zero-sum decision problem. State transitions are isolated in an immutable representation to support future adversarial search algorithms.
Core architectural principles:
- Clear domain modeling (
model/) - Immutable search state design (
search/) - Evaluation abstraction
- Isolation of UI, persistence, and engine concerns
The repository is structured around two clear layers:
Implements the playable version of Gomoku.
- Rule enforcement
- Win detection (horizontal, vertical, diagonal)
- Dynamic grid expansion
- Terminal interface
- Serialization-based persistence
- Player abstraction with
HumanandAIPlayerimplementations
Isolated package intended for adversarial search algorithms.
- Immutable
GameState MoveabstractionPlayerType(MAX / MIN semantics)Evaluatorinterface for heuristic scoringGameStateFactorybridging model → search representation
- Depth-limited Minimax
- Alpha-Beta pruning
- Move ordering
- Benchmarking tools
- Unit tests for search correctness
The project enforces separation of concerns:
app/— orchestration and game loopmodel/— core game domainai/— baseline gameplay AIsave/— persistence layerutil/— console utilitiessearch/— adversarial search layer
Design principles applied:
- Clear package boundaries
- Immutable search state preparation
- Search logic isolated from UI
- Evaluation abstraction for extensibility
Model layer class diagram.
View UML
Folder layout and responsibilities.
View Structure
Design decisions and dependency rules.
Read Architecture Notes
The architecture allows:
- Independent evolution of search algorithms
- Safe recursive exploration (immutability)
- Replacement of UI without touching engine logic
- Unit testing of search components in isolation
The system is designed to support adversarial search algorithms without restructuring the gameplay layer.
| Platform | Run Application | Generate Javadoc |
|---|---|---|
| Windows | runGomoku.bat |
generateDocs.bat |
| Linux/macOS | ./runGomoku.sh |
./generateDocs.sh |
javac -d target/classes src/main/java/*/*.java
java -cp target/classes app.GomokuThis project was originally developed on GitLab during a university course.
The full commit history and initial development can be found here: Gomoku-Gitlab
This GitHub repository provides a cleaned version of the code with additional documentation and architectural notes.
Erkin Tunc Boya