Skip to content

This is an implementation of the AlphaZero algorithm for playing the simple board game Gomoku (also called Gobang or Five in a Row)

Notifications You must be signed in to change notification settings

xzabg/AlphaZero_Gobang

Repository files navigation

AlphaZero-Gomoku

This is an implementation of the AlphaZero algorithm for playing the simple board game Gomoku (also called Gobang or Five in a Row) from pure self-play training. The game Gomoku is much simpler than Go or chess, so that we can focus on the training scheme of AlphaZero and obtain a pretty good AI model on a single PC in a few hours.

As for a standard board(15x15, 5 in a row), it may take too long to train with a single GPU, so a pretrained model by supervised learning with about 6000 human manuals is given. Further training with reinforcement learning method is based on this model.

References:

  1. AlphaZero: Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm
  2. AlphaGo Zero: Mastering the game of Go without human knowledge

Requirements

To play with the trained AI models, only need:

  • Python >= 2.7
  • Numpy >= 1.11

Getting Started

To play with provided models, run the following script from the directory:

python human_play.py  

You may modify human_play.py to try different provided models or the pure MCTS.

To train the AI model from scratch, with Theano and Lasagne, directly run:

python train.py

Tips for training:

  1. It is good to start with a 6x6 board and 4 in a row. For this case, we may obtain a reasonably good model within 500~1000 self-play games in about 2 hours.
  2. For the case of 8x8 board and 5 in a row, it may need 2000~3000 self-play games to get a good model, and it may take about 2 days on a single PC.

About

This is an implementation of the AlphaZero algorithm for playing the simple board game Gomoku (also called Gobang or Five in a Row)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages