Practical overview
When it fits
Use it when you want a compact board-game project for exploring AlphaZero-style self-play, or a Python implementation to play against and adapt. Start with provided models if the aim is to play; choose a training backend and board configuration if the aim is to experiment with learning.
Who it is for
- Developers learning how self-play reinforcement learning and Monte Carlo tree search can be combined in a board-game AI.
- Gomoku players who want to play against the project’s provided trained models.
- Researchers or students experimenting with policy-value networks and alternative training backends.
Documented uses
- Play Gomoku against a provided trained AI model.
- Train a Gomoku policy-and-value model through self-play.
- Explore or modify MCTS-based move selection and compare supported neural-network backends.
Requirements & limits
The repository is public and MIT-licensed. Playing with provided models requires Python 2.7 or later and NumPy 1.11 or later; training additionally requires one of the documented deep-learning stacks.
- Playing has fewer prerequisites than training: Python and NumPy are listed for the provided models, while training needs Theano/Lasagne, PyTorch or TensorFlow.
- Theano/Lasagne is the documented direct training path; PyTorch and TensorFlow require editing
train.pyto switch the policy-value network import. - The provided models were trained with Theano/Lasagne, and the README points to a separate issue for using them with PyTorch.
- Training time depends on the configuration: the README estimates about two hours for a 6 × 6 board with four in a row, versus about two days for an 8 × 8 board with five in a row on a single PC.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Play against a provided Gomoku model
Start a local game against one of the repository’s provided trained models.
Before you start
- Python 2.7 or later
- NumPy 1.11 or later
- The repository files and provided model files
Steps
From the project directory, run the command below.
python human_play.pyModify
human_play.pyif you want to select another provided model or try pure MCTS.
Expected outcome
A playable session against the selected trained AI or pure MCTS.
Guide limitations
- The four provided models were trained with Theano/Lasagne; using them with PyTorch requires consulting the project’s issue 5 reference.
Select a backend before training
Configure the documented training script to use the PyTorch or TensorFlow policy-value network.
Before you start
- Python environment with either PyTorch 0.2.0 or later, or TensorFlow
- The project repository
Steps
Open
train.py.Comment out the Theano/Lasagne
PolicyValueNetimport.Uncomment the import for the PyTorch or TensorFlow policy-value network.
Run the command below.
python train.py
Expected outcome
The training script is configured to use the selected backend and can begin training.
Guide limitations
- The README gives a direct
python train.pyinstruction for Theano/Lasagne; PyTorch and TensorFlow require the import change first. - GPU use with PyTorch has additional version-specific code notes in the README.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- junxiaosong/AlphaZero_Gomoku · Official homepage title · retained in its source language

