Home

Awesome

TamaGo

TamaGo is a Go (Weiqi, Baduk) engine implemented in Python. TamaGo has following features,

TamaGo runs on Python 3.6 or higher.

日本語はこちらをご覧ください。

中文文檔請看這裡

Requirements

Package namePurpose
clickImplementation of command line options
numpyFast calculation
pytorchImplementation of neural network construction and learning

Installation

You can install TamaGo by executing the following command in a Python-installed computer.

pip install -r requirements.txt

You can use TamaGo with CPU only. It is recommended that you set up your computer so that you can use a GPU when executing neural network learning.

How to execute GTP engine

When using a GUI that supports GTP (Go Text Protocol), the following command canb be used TamaGo as a engine,

python main.py

TamaGo's command line options are as follows,

OptionDescriptionValueExample of valueDefault valueNote
--sizeSize of go boardInteger number more than 1 and less than or equal to BOARD_SIZE9BOARD_SIZEBOARD_SIZE is defined in board/constant.py.
--superkoActivation super-ko ruletrue or falsetruefalseIt supports only positional super-ko.
--modelPath to a trained neural network parameters fileString of model file pathmodel/model.binNoneIt must be relative path from TamaGo's home directory
--use-gpuFlag to use a GPUtrue or falsetruefalse
--policy-moveFlag to move according to Policy distributiontrue or falsetruefalse
--sequential-halvingFlag to use SHOT (Sequential Halving applied to trees) for searchingtrue or falsetruefalseIt's for debugging
--visitsThe number of visits per moveInteger number more than 010001000When you use '--const-time' or '--time' options, this option is ignored.
--const-timeTime to thinking per moveReal number more than 010.0NoneWhen you use '--const-time' or '--time' options, this option is ignored.
--timeTotal remaining time for a gameReal number more than 0600.0None
--batch-sizeMini-batch size for MCTSInteger number more than 013NN_BATCH_SIZENN_BATCH_SIZE is defined in mcts/constant.py.
--tree-sizeMaximum number of MCTS nodesInteger number more than 0100000MCTS_TREE_SIZEMCTS_TREE_SIZE is defined in mcts/constant.py.
--cgos-modeEnable to capture all dead stones.true or falsetruefalse

Examples of TamaGo execution as GTP engine.

  1. Setting board size to 5, using model/model.bin as a trained file, avoiding to use a GPU.
python main.py --size 5 --model model/model.bin --use-gpu false
  1. Activating super-ko rule.
python main.py --superko true
  1. Using model/sl-model.bin as a trained file, generating moves with Policy distribution.
python main.py --model model/sl-model.bin --policy-move true
  1. Setting total remaining time to 10 minites.
python main.py --time 600
  1. Setting the number of visits per move to 500.
python main.py --visits 500
  1. Setting time to thinking time per move to 10 seconds.
python main.py --const-time 10.0
  1. Settings for testing on CGOS.
python main.py --model model/sl-model.bin --use-gpu true --cgos-mode true --superko true --batch-size 13 --time 600 --komi 7 --tree-size 200000

Trained neural network parameters file.

Trained neural network parameters file is available here. When you place a trained file in the "model" direcotry under the name "model.bin", you can run TamaGo using a trained file without a command line option. If TamaGo's structure of neural network and a trained neural network parameter files are unmached, TamaGo cannot load a trained file. Please care about version of the trained model file and version of TamaGo. On TamaGo 0.6.3 is pretty stronger than GNUGo level 10 (about +420 elo). Using Monte Carlo tree search, TamaGo 0.6.3 (100 visits/move) with sl-model.bin is stronger than Ray ver 9.0 10k playouts/move (about +180 elo).
TamaGo has changed it's neural network structure from version 0.6.0, You cannot use trained model files for older version.

How to execute supervised learning

For more information on how to execute supervised learning, please check here.

How to execute reinforcement learning

For more information on how to execute reinforcement learning, please check here.

GoGui analyze commands

When you use GoGui, you can check Policy values for current position, and color according to Policy values.
Value range of Policy is more than or equal 0.0 and less than or equal to 1.0.

Display policy value

Redder is higher value, bluer is lower value.

Coloring policy value

Analyze commands

TamaGo version 0.7.0 supports lz-analyze and lz-genmove_analyze commands. When you use Lizzie or Sabaki, you can analyze positions using these commands. lz-analyze-sample

CGOS analyze mode

TamaGo version 0.7.0 supports cgos-analyze, cgos-genmove_analyze commands. When you connect Computer Go Server (CGOS) for testing TamaGo, you can check search information enabling --cgos-mode option.

cgos-analyze

cgos-analyze-pv

License

You can use TamaGo under Apache License 2.0.