AlphaZero for mere mortals: self-play Gomoku on one PC
It exists because Gomoku is simple enough to let you study AlphaZero’s training loop without renting a server farm.

What it does
This project is a pure self-play implementation of the AlphaZero algorithm targeting Gomoku, also known as Five in a Row. Because the game is far less complex than Go or chess, the training pipeline collapses to something a single PC can handle. You end up with a neural network guided by Monte Carlo Tree Search that learns board strategy from nothing but its own games.
The interesting bit
The cleverness is in the shrink-wrap: the author uses Gomoku’s simplicity as a test tube for the AlphaZero training scheme itself. It is less about building the world’s best Gomoku engine and more about making the algorithm tangible and tweakable on commodity hardware.
Key highlights
- Trains from pure self-play with no human game data or heuristics.
- Supports three deep-learning backends: Theano/Lasagne, PyTorch, and TensorFlow.
- A reasonably good 6×6 model trains in roughly two hours; an 8×8 board needs closer to two days on a single PC.
- Ships with four pre-trained models so you can play against the AI immediately.
- The network logic is isolated in
policy_value_net.py, making it straightforward to port to another framework.
Caveats
- The default training path still points to Theano and Lasagne, which now require version-pinning workarounds.
- Switching to PyTorch or TensorFlow currently requires swapping imports inside
train.py. - The bundled pre-trained models were built with Theano/Lasagne, so using them in PyTorch requires extra conversion steps.
Verdict
Grab this if you want a compact, hackable AlphaZero reference you can actually train at home. Skip it if you are looking for a polished, framework-agnostic engine or state-of-the-art Gomoku performance.
Frequently asked
- What is junxiaosong/AlphaZero_Gomoku?
- It exists because Gomoku is simple enough to let you study AlphaZero’s training loop without renting a server farm.
- Is AlphaZero_Gomoku open source?
- Yes — junxiaosong/AlphaZero_Gomoku is open source, released under the MIT license.
- What language is AlphaZero_Gomoku written in?
- junxiaosong/AlphaZero_Gomoku is primarily written in Python.
- How popular is AlphaZero_Gomoku?
- junxiaosong/AlphaZero_Gomoku has 3.6k stars on GitHub.
- Where can I find AlphaZero_Gomoku?
- junxiaosong/AlphaZero_Gomoku is on GitHub at https://github.com/junxiaosong/AlphaZero_Gomoku.