This project is a fork of the pachi.git project. If you have that one already cloned locally, you can use
git clone --reference /path/to/your/pachi.git/incarnation mirror_URL
to save bandwidth during cloning.
descriptionArtificial Neural Net engine
last changeSat, 1 Jan 2011 13:43:06 +0000 (1 14:43 +0100)
content tags
Pachi is two things: a simple modular framework for robots playing
the game of Go/Weiqi/Baduk, and a reasonably strong engine built
within this framework.


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 random Monte-Carlo playouts.

The default engine plays by Chinese rules and should be about
2d KGS strength on 9x9. On 19x19, it might be about KGS 4k. Of couse,
this assumes reasonable hardware, e.g. four-threaded Core2 machine.

At the same time, various other approaches and tricks are being tried
and minor improvements have been achieved; they are enabled when they
give an universal playing strength boosts.

By default, Pachi will run on a single CPU core, taking up to 3GiB
of memory, not pondering, etc. You can adjust these parameters by
passing it extra command-line options:

	./zzgo -t _1200 threads=8,max_tree_size=500,fast_alloc

This will make Pachi play with time settings 20:00 S.D. (unless it
gets told otherwise over GTP), with 8 threads, taking up to 500MiB
of memory (+ several tens MiB as a constant overhead). 'fast_alloc'
is just a good idea to do in case of memory-sensitive runs (will become
default soon).

For now, there is no comprehensive documentation, 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.

Pachi can be used as a test opponent for development of other go-playing
programs. For example, to get the "plainest UCT" player, use:

	./zzgo -t =5000 policy=ucb1,playout=light,prior=eqex=0,dynkomi=none

This will fix the number of playouts per move to 5000, switch the node
selection policy from ucb1amaf to ucb1 (i.e. disable RAVE), switch the
playouts from heuristic-heavy moggy to uniformly random light, stop
prioring the node values heuristically, and turn off dynamic komi.

You can of course selectively re-enable various features or tweak this
further. But please note that using Pachi in this mode is not tested
extensively, so check its performance in whatever version you test
before you use it as a reference.

Note that even in this "basic UCT" mode, Pachi optimizes tree search
by considering board symmetries at the beginning. Currently, there's no
easy option to turn that off. The easiest way is to tweak board.c so
that board_symmetry_update() has goto break_symmetry at the beginning
and board_clear has board->symmetry.type = SYM_NONE.

Except UCT, Pachi supports a simple idiotbot-like engine and an example
treeless MonteCarlo-player. The MonteCarlo simulation ("playout")
policies are also pluggable, by default we use one that makes use of
heavy domain knowledge.

Two special engines are also provided for development support:
* a simple "replay" engine that will simply play moves according
  to the playout policy suggestions
* a special "patternscan" engine that will respond to 'play' commands
  by iteratively matching various pattern features on each move and
  outputting them as response to the command; it is intended to be
  used for pattern-learning from games in cooperation with an external
  helper; no 'genmove' command support is provided


Pachi can also help you analyze your games, by being able to provide
its opinion on various positions. The user interface is very rudimentary,
but the ability is certainly there.

There are currently two Pachi interfaces for this purpose. One
possibility is to evaluate all moves within a given game and show how
the winrates for both players evolved - i.e. who was winning at which
game stage. This is implemented using the `` script. See
the comment on top of the script about its usage.

Alternatively, Pachi can evaluate all available moves in a given situation
and for each give a value between 0 and 1 representing perceived
likelihood of winning the game if one would play that move. I.e. it can
suggest which moves would be good and bad in a single given situation.

To achieve the latter, follow few simple steps:

1. Take an SGF record of your game and generate a GTP file from it:

	./ <file.sgf >file.gtp

2. Open the file.gtp in your favorite plaintext editor and trim it after
(remove all lines following) the move producing the situation you wish
to analyze.

3. Instead, add the following line at the bottom of file.gtp:

	0 uct_evaluate black

(replace `black` with `white` if it is white to play).

4. Run Pachi as follows:

	./zzgo -t =500 -d 0 <file.gtp | sed -n '/^=0/,${s/^=0 //;p}'

If you want to know more details on what is Pachi thinking about the
various moves, remove the `-d 0` and `| sed -n ...` parts. To improve
the accuracy of values (at the expense of run time), raise the value
of 500 (try 2000 or 10000; 100000 will usually already take couple of
hours). The values will be most useful in the middle game; in fuseki
and most yose situations, expect a lot of noise.


The aim of the framework is to make it easy to plug your engine
to the common infrastructure and implement your ideas while
minimalizing the overhead of implementing the GTP, speed-optimized
board tools, etc.  Also, there are premade random playout and UCT
tree engines, so that you can directly tweak only particular policies.
The infrastructure is pretty fast and it should be quite easy
to extend it to provide more facilities for your engine (but it should
be at the same time kept as simple as possible).


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.


To build Pachi, simply type:


Built zzgo binary (named that way from historical reasons) in the current
directory is a GTP client; use your favorite Go client to connect to it
(generally it should be possible to use it in place of GNU Go; the
command-line usage is however different), or use kgsGtp to connect to KGS;
DO NOT make it accessible directly to enemy users since the parser is
not secure - see the HACKING file for details.

The zzgo binary can take many parameters, as well as the particular
engine being used; the defaults should be fine for initial usage,
you will have to consult the sources for fine-tuning the parameters.

To build better optimized binary, type:

	make zzgo-profiled

This will also create binary zzgo, but while the build will take
more time (probably less than a minute anyway), the resulting binary
will be about 1/4 to 1/5 faster.
2011-01-01 Petr BaudisMerge branch 'master' of git+ssh:// master
2010-12-30 Jean-loup GaillyUCT engine: change virtual_loss from bool to int
2010-12-25 Jean-loup GaillyUCT engine: Allow spending more time on a single move
2010-12-25 Jean-loup GaillyDistributed engine: Use larger receive queue to allow...
2010-12-25 Jean-loup GaillyMerge branch 'master' into test3
2010-12-25 Jean-loup GaillyDistributed engine: Transmit values in double precision
2010-12-23 Petr BaudisDebugging: Introduce -D (debug_boardprint) for more...
2010-12-22 Petr BaudisUCB1AMAF local tree: Add missing LTREE_PLAYOUTS_MULTIPL...
2010-12-22 Petr Baudislocal_tree_depth_decay: Introduce
2010-12-22 Petr Baudisucb1rave_evaluate() ltree_rave: Fix float multiplication
2010-12-22 Jean-loup GaillyUse correct format when scanning double floating point...
2010-12-21 Jean-loup GaillyAllow double for all floating point values in large...
2010-12-15 Petr BaudisMerge remote branch 'origin/master'
2010-12-15 Petr BaudisUCT treepool_pickfactor: Introduce for non-uniform...
2010-12-15 Petr BaudisUCT significant: Move out of descent structure, track...
2010-12-15 Petr BaudisUCT treepool_setup(): Fix finding best move
5 years ago pachi-6.00-dochi
6 years ago pachi-5.00-dosaku
6 years ago pachi-4.00-doetsu
6 years ago pachi-3.00-sanetsu
6 years ago pachi-2.00-sansa
5 years ago mob
5 years ago master
5 years ago moggypd
6 years ago ann_base
6 years ago playerguess