Abstract
This study investigates the adaptability of the AlphaZero framework to Gomoku ("Five in a Row"), a zero-sum game with significant tactical complexity. By combining deep reinforcement learning with Monte Carlo Tree Search (MCTS), we developed an agent capable of discovering sophisticated winning strategies—such as "forks" and "fours"—without human domain knowledge. Our results show that the AlphaZero agent achieves a 100% win rate as the first player on smaller board variants and significantly outperforms traditional MCTS baselines in both efficiency and strategic depth.
Introduction
While AlphaZero has demonstrated mastery in Go, Chess, and Shogi, its generalizability to other board games remains a subject of interest. This research applies the AlphaZero architecture to Gomoku, a game characterized by a simple ruleset but profound strategic depth. In standard Gomoku, the first player (black) possesses a known theoretical advantage. The primary objective was to determine if an AlphaZero-based agent could autonomously discover these winning strategies and defensive maneuvers through self-play, and how its performance would compare to conventional search algorithms.
Methodology
The core of the implementation is the AlphaZero architecture, which utilizes a dual-headed deep neural network integrated with a guided search process.
The Dual-Headed Network
The model employs a convolutional neural network with two distinct output heads:
- Policy Network ($\pi$): Predicts the probability distribution over moves, guiding the search toward the most promising areas of the board.
- Value Network ($V$): Estimates the expected outcome (win probability) from a given board state.
Guided Monte Carlo Tree Search (MCTS)
Unlike "pure" MCTS, which relies on random rollouts to evaluate positions, this guided version uses the neural network to prune the search tree. The policy network prioritizes move exploration, while the value network provides immediate state evaluations, significantly reducing the computational cost of deep searches.
Training and State Representation
The agent was trained entirely through self-play on $6 \times 6$ (4-in-a-row) and $8 \times 8$ (5-in-a-row) boards. The board state is represented as four binary feature matrices: the current player’s stones, the opponent’s stones, the most recent move, and an indicator for the initiating player. No external datasets were used, as the model generates its own training data through iterative self-play.
Results and Discussion
The AlphaZero agent demonstrated rapid learning and strategic sophistication, effectively "solving" the tested board variants.
Performance Benchmarking
In head-to-head comparisons, AlphaZero consistently outperformed pure MCTS baselines. Even when the MCTS algorithm was permitted significantly more iterations (up to 2500), the AlphaZero agent maintained a superior win rate, demonstrating the efficiency of neural-network-guided search.
Discovery of Tactical Patterns
A key finding was the agent's independent discovery of critical Gomoku tactics without explicit programming:
- The "Four": Creating a line of four stones such that the fifth move is an inevitable win.
- The "Fork": Executing a move that creates two simultaneous threats, forcing a win as the opponent can only block one.
Furthermore, the agent exhibited strong defensive capabilities when playing as the second player, identifying and neutralizing opponent threats before they could develop into winning forks.
Conclusion
This research confirms that the AlphaZero framework is highly effective for mastering Gomoku. The agent's ability to solve smaller board variants and outperform traditional search methods highlights the power of combining deep learning with guided MCTS. Future work will focus on scaling the approach to the standard $15 \times 15$ grid and exploring the framework's performance under "Renju" rules to mitigate the inherent first-player bias.
Summary updated