UCT fast_alloc: Make default
[pachi/pachi-r6144.git] / README
blob91261f42c2080c4f3cea1061c4a6a698020ea160
1 Pachi can refer to: a simple modular framework for programs playing
2 the game of Go/Weiqi/Baduk, and a reasonably strong engine built
3 within this framework.
6 Installation
7 ------------
9 To build Pachi, simply type:
11         make
13 The resulting binary program `zzgo` (named that way from historical
14 reasons) is a GTP client; connect to it using your favorite Go program
15 interface (e.g. gogui or qgo), or use kgsGtp to connect it to KGS.
16 (DO NOT make the GTP interface accessible directly to untrusted users
17 since the parser is not secure - see the HACKING file for details.)
19 The zzgo binary can take many parameters, as well as the particular
20 engine being used; the defaults should be fine for initial usage,
21 see below for some more tips.
23 In case you hit compilation issues (e.g. when building on MacOS/X)
24 or want to change the build configuration, check the user configurable
25 section at the top of the Makefile.
28 Engine
29 ------
31 The default engine plays by Chinese rules and should be about
32 3d KGS strength on 9x9. On 19x19, it might be about KGS 2k, assuming
33 reasonable hardware, e.g. two-core Athlon64 machine.  On a higher-end
34 (e.g. six-way Intel i7) machine, it can hold a solid KGS 1d rank.
35 When using a large cluster (64 machines, 20 cores each), it will
36 maintain KGS 3d and has won a 7-stone handicap against Zhou Junxun 9p.
38 By default, Pachi currently uses the UCT engine that combines
39 Monte Carlo approach with tree search; UCB1AMAF tree policy using
40 the RAVE method is used for tree search, while the Moggy playout
41 policy using 3x3 patterns and various tactical checks is used for
42 the semi-random Monte Carlo playouts.
44 At the same time, we keep trying a wide variety of other approaches
45 and enhancements. Pachi is an active research platform and quite a few
46 improvements have been already achieved. We rigorously play-test new
47 features and enable them by default only when they give a universal
48 strength boost.
51 By default, Pachi will run on a single CPU core, taking up to 3GiB
52 of memory, not pondering, etc. You can adjust these parameters by
53 passing it extra command-line options:
55         ./zzgo -t _1200 threads=8,max_tree_size=500,pondering
57 This will make Pachi play with time settings 20:00 S.D. (unless it
58 gets told otherwise over GTP), with 8 threads, taking up to 500MiB
59 of memory (+ several tens MiB as a constant overhead) and thinking
60 during the opponent's turn as well.
62 For now, there is no comprehensive documentation of options, but you
63 can get a pretty good idea by looking at the uct_state_init() function
64 in uct/uct.c - you will find the list of UCT engine options there, each
65 with a description.
68 Except UCT, Pachi supports a simple idiotbot-like engine and an example
69 treeless MonteCarlo-player. The MonteCarlo simulation ("playout")
70 policies are also pluggable, by default we use the one that makes use of
71 heavy domain knowledge.
73 Other special engines are also provided:
74 * a "distributed" engine for cluster play; the description at the top of
75   distributed/distributed.c should provide all the guidance
76 * a simple "replay" engine that will simply play moves according
77   to the playout policy suggestions
78 * few other purely for development usage
81 Pachi can be used as a test opponent for development of other go-playing
82 programs. For example, to get the "plainest UCT" player, use:
84         ./zzgo -t =5000 policy=ucb1,playout=light,prior=eqex=0,dynkomi=none
86 This will fix the number of playouts per move to 5000, switch the node
87 selection policy from ucb1amaf to ucb1 (i.e. disable RAVE), switch the
88 playouts from heuristic-heavy moggy to uniformly random light, stop
89 prioring the node values heuristically, and turn off dynamic komi.
91 You can of course selectively re-enable various features or tweak this
92 further. But please note that using Pachi in this mode is not tested
93 extensively, so check its performance in whatever version you test
94 before you use it as a reference.
96 Note that even in this "basic UCT" mode, Pachi optimizes tree search
97 by considering board symmetries at the beginning. Currently, there's no
98 easy option to turn that off. The easiest way is to tweak board.c so
99 that board_symmetry_update() has goto break_symmetry at the beginning
100 and board_clear has board->symmetry.type = SYM_NONE.
103 Analysis
104 --------
106 Pachi can also help you analyze your games by being able to provide
107 its opinion on various positions. The user interface is very rudimentary,
108 but the ability is certainly there.
110 There are currently two Pachi interfaces provided for this purpose. One
111 possibility is to evaluate all moves within a given game and show how
112 the winrates for both players evolved - i.e. who was winning at which
113 game stage. This is implemented using the `tools/sgf-analyse.pl` script.
114 See the comment on top of the script about its usage.
116 Alternatively, Pachi can evaluate all available moves in a given situation
117 and for each give a value between 0 and 1 representing perceived
118 likelihood of winning the game if one would play that move. I.e. it can
119 suggest which moves would be good and bad in a single given situation.
121 To achieve the latter, follow few simple steps:
123 1. Take an SGF record of your game and generate a GTP file from it:
125         tools/sgf2gtp.pl <file.sgf >file.gtp
127 2. Open the file.gtp in your favorite plaintext editor and trim it after
128 (remove all lines following) the move producing the situation you wish
129 to analyze.
131 3. Instead, add the following line at the bottom of file.gtp:
133         0 uct_evaluate black
135 (replace `black` with `white` if it is white to play).
137 4. Run Pachi as follows:
139         ./zzgo -t =500 -d 0 <file.gtp | sed -n '/^=0/,${s/^=0 //;p}'
141 If you want to know more details on what is Pachi thinking about the
142 various moves, remove the `-d 0` and `| sed -n ...` parts. To improve
143 the accuracy of values (at the expense of run time), raise the value
144 of 500 (try 2000 or 10000; 100000 will usually already take couple of
145 hours). The values will be most useful in the middle game; in fuseki
146 and most yose situations, expect a lot of noise.
149 Framework
150 ---------
152 The aim of the software framework is to make it easy to plug your
153 engine to the common infrastructure and implement your ideas while
154 minimalizing the overhead of implementing the GTP, speed-optimized
155 board implementation, etc.  Also, there are premade random playout
156 and UCT tree engines, so that you can directly tweak only particular
157 policies.  The infrastructure is pretty fast and it should be quite
158 easy for you (or us) to extend it to provide more facilities for
159 your engine.
161 See the HACKING file for a more detailed developer's view of Pachi.
164 Licence
165 -------
167 Pachi is distributed under the GPLv2 licence (see the COPYING file for
168 details and full text of the licence); you are welcome to tweak it as
169 you wish (contributing back upstream is welcome) and distribute
170 it freely, but only together with the source code. You are welcome
171 to make private modifications to the code (e.g. try new algorithms and
172 approaches), use them internally or even to have your bot play on the
173 internet and enter competitions, but as soon as you want to release it
174 to the public, you need to release the source code as well.
176 One exception is the Autotest framework, which is licenced under the
177 terms of the MIT licence (close to public domain) - you are free to
178 use it any way you wish.