Pachi can refer to: a simple modular framework for programs playing the game of Go/Weiqi/Baduk, and a reasonably strong engine built within this framework.
The default engine plays by Chinese rules and should be about 7d KGS strength on 9x9. On 19x19 it can hold a solid KGS 2d rank on modest hardware (Raspberry Pi, dcnn) or faster machine (e.g. six-way Intel i7) without dcnn.
When using a large cluster (64 machines, 20 cores each), it maintains KGS 3d to 4d and has won e.g. a 7-stone handicap game against Zhou Junxun 9p.
By default, Pachi currently uses the UCT engine that combines Monte Carlo approach with tree search; UCB1AMAF tree policy using the RAVE method is used for tree search, while the Moggy playout policy using 3x3 patterns and various tactical checks is used for the semi-random Monte Carlo playouts. MM patterns are used in the tree search.
Linux / Windows: Download binary release and follow instructions inside.
Ubuntu: Install 'pachi-go' package from ppa:
sudo add-apt-repository ppa:lemonsqueeze/pachi sudo apt-get update sudo apt-get install pachi-go
Performance might be better if you recompile for your own system though.
For build instructions see INSTALL.
DO NOT make the GTP interface accessible directly to untrusted users since the parser is not secure - see the HACKING file for details.
The pachi program can take many parameters. The defaults should be fine for initial usage, see below for more tips.
Pachi uses a neural network as source of good moves to consider (policy network). With dcnn support Pachi can play at dan level on modest hardware. For large number of playouts this makes it about 1 stone stronger and makes the games more pretty. A raw dcnn engine is available for pure dcnn play (not recommended for actual games, pachi won't know when to pass or resign !).
pachi --list-dcnn List supported networks.
pachi --dcnn=name Choose network to use (Detlef's 54% dcnn by default).
Releases come with Detlef's 54% dcnn by default. For other networks see Pachi Networks.
Currently dcnn is used for root node only.
How to run
By default Pachi will run on all cores, using up to 200Mb of memory for tree search and taking a little under 10 seconds per move. You can adjust these parameters by passing it extra command line options.
For main options description try:
Pachi can smartly deal with a variety of time settings (canadian byoyomi recommended to maximize efficient time allocation). However, most of these are accessible only via GTP, that is by the frontend keeping track of time, e.g. KGS or gogui.
It's also possible to force time settings via the command line (GTP time settings are ignored then):
pachi -t 2020s per move.
pachi -t _60010 minutes sudden death.
pachi -t =50005000 playouts per move.
pachi -t =5000:15000Think more when needed. Same but up-to 15000 playouts if best move is unclear.
pachi -t =5000:15000 --fuseki-time =4000Don't think too much during fuseki.
Pachi will play fast on a fast computer, slow on a slow computer, but strength will remain the same:
pachi -t =5000:15000 --dcnn=dfkgs 3d
pachi -t =5000:15000kgs 2d
pachi -t =5000 --nodcnnkgs 3k (mcts only).
pachi --kgs when playing on KGS. See kgsgtp.conf for example.
pachi resign_threshold=0.25Resign when winrate < 25% (default: 20%).
pachi reportfreq=1sShow search progress every second (default: 1000 playouts).
pachi -t 10 threads=4,max_tree_size=100
Play with 10s per move on 4 threads, taking up to 100Mb of memory (+ several tens Mb as a constant overhead).
pachi -t _1200 --nodcnn threads=8,max_tree_size=3072,pondering
Play without dcnn with time settings 20:00 S.D. on 8 threads, taking up to 3Gb of memory, and thinking during the opponent's turn as well.
Pachi 12.50 Note: By default Pachi automatically allocates memory for tree search now so you shouldn't have to set "max_tree_size" anymore unless you want to limit max memory used. See here for details.
For now, there is no comprehensive documentation of engine options, but you can get a pretty good idea by looking at the uct_state_init() function in uct/uct.c - you will find the list of UCT engine options there, each with a description. At any rate, usually the four options above are the only ones you really want to tweak.
When running Pachi through GoGui, a number of graphic tools are available
Tools -> Analyze commands window:
- Best moves
- Score estimate
- DCNN ratings ...
It's also possible to visualize best moves / best sequence while Pachi is thinking via the live gfx commands.
It's also possible to run Pachi with Lizzie to analyze things !
This is a great way to explore variations, analyze games or visualize what Pachi is doing while it's thinking, the graphics are amazing.
Install Lizzie 0.7.2
Download Pachi 12.50, extract in Lizzie folder
Menu -> Settings -> Engine
Add Pachi as "Engine 2":
Engine 2: ./pachi/pachi.exe -o pachi.log
Normally Leela-zero and Katago are Default Engine and Engine 1.
Lizzie will start with Leela-zero by default,
Menu -> Engine -> Engine 2to switch to Pachi.
(Window title shows current engine).
Pachi logs details of its activity on stderr, which can be viewed via
Tools -> GTP Shell in gogui. Tons of details about winrates, memory usage,
score estimate etc can be found here. Even though most of it available through
other means in gogui, it's always a good place to look in case something
-d <log_level> changes the amount of logging (-d0 suppresses everything)
-o log_file logs to a file instead. gogui live-gfx commands won't work though.
Also, if you are interested about Pachi's architecture, algorithms etc., consider taking a look at Petr Baudis' Master's Thesis:
...or a slightly newer scientific paper on Pachi:
Pachi is distributed under the GPLv2 licence (see the COPYING file for details and full text of the licence); you are welcome to tweak it as you wish (contributing back upstream is welcome) and distribute it freely, but only together with the source code. You are welcome to make private modifications to the code (e.g. try new algorithms and approaches), use them internally or even to have your bot play on the internet and enter competitions, but as soon as you want to release it to the public, you need to release the source code as well.
One exception is the Autotest framework, which is licenced under the terms of the MIT licence (close to public domain) - you are free to use it any way you wish.