version 1.4.39b
[polyglot.git] / README
1 POLYGLOT(6)                                                        POLYGLOT(6)
2
3
4
5 NAME
6        PolyGlot -  Winboard protocol to UCI protocol adapter
7                 -  book engine for Polyglot books
8                 -  a collection of utilities for creating and analyzing open-
9        ing books
10                 -  a utility for analyzing epd files
11                 -  a perft counter
12
13 SYNOPSIS
14        polyglot [configfile] [-noini] [-ec engine] [-ed enginedirectory] [-en
15        enginename] [-log] [-lf logfile] [-hash value] [-bk book] [-pg
16        <name>=<value>]* [-uci <name>=<value>]*
17
18        polyglot make-book [-pgn inputfile] [-bin outputfile] [-max-ply ply]
19        [-min-game games] [-min-score score] [-only-white] [-only-black] [-uni-
20        form]
21
22        polyglot merge-book -in1 inputfile1 -in2 inputfile2 [-out outputfile]
23
24        polyglot info-book [-bin inputfile] [-exact]
25
26        polyglot dump-book [-bin inputfile] -color color [-out outputfile]
27
28        polyglot [configfile] epd-test [engineoptions] [-epd inputfile]
29        [-min-depth depth] [-max-depth depth] [-max-time time] [-depth-delta
30        delta]
31
32        polyglot perft [-fen fen] [-max-depth depth]
33
34 DESCRIPTION
35        PolyGlot as adapter and book engine
36
37        PolyGlot is a "UCI adapter".  It connects a GUI interface (such as
38        XBoard, Winboard, Arena or Chessbase) to a UCI chess engine.
39
40        By specifying an opening book (in PolyGlot book format) chess engines
41        can transparently use such books.
42
43        PolyGlot understands the two main GUI protocols: UCI and xboard. Nor-
44        mally the protocol will be auto detected but this can be overridden in
45        the configuration file.
46
47        In xboard mode PolyGlot fully translates between the xboard and UCI
48        protocols.  In addition it tries to solve known problems with other
49        adapters.  For instance, it detects and reports draws by fifty-move
50        rule, repetition, etc ... It also supports Chess960.
51
52        When in UCI mode PolyGlot mostly passes commands from the GUI to the
53        engine and vice versa, except that it will play book moves on behalf of
54        the engine when the occasion arises.
55
56        The engine options are exported as UCI options in UCI mode and as "fea-
57        ture option=" commands in xboard mode. The latter form an extension of
58        the xboard protocol as defined by H.G. Muller.
59
60        Options which normally appear in the [PolyGlot] section of the config
61        file (see below) are exported as options with their name prefixed by
62        "Polyglot". This makes it easy to filter them in the GUI.
63
64        NOTE: Not all options are exported, only those that make sense in the
65        given mode.
66
67        Book making utilities
68
69        PolyGlot supports the "PolyGlot opening book format". This is the
70        defacto standard non-proprietary opening book format. It is fully docu-
71        mented here
72
73        http://alpha.uhasselt.be/Research/Algebra/Toga/book_format.html
74
75        Roughly speaking a PolyGlot opening book is a collection of triples
76        (position, move, weight). A "position" is represented by a 64-bit
77        Zobrist hash key. The weight is proportional to the probability the
78        move should be played.
79
80        Other opening book formats such as ChessBase's .ctg format and Arena's
81        .abk format are undocumented and proprietary. They can only be used by
82        their own GUIs.
83
84        PolyGlot can compile a pgn file into a binary PolyGlot book and fur-
85        thermore it can merge two such binary books into a third one.
86
87        PolyGlot can also extract some useful information from PolyGlot books.
88        The utility "dump-book" dumps the "lines" in a book for a given color.
89        By definition a line is a sequence of moves (from the starting posi-
90        tion) in which the given color makes only book moves and the other
91        color makes arbitrary moves (i.e. not necessarily book moves).
92
93        Since a PolyGlot book is built up from positions and not lines there
94        may be (and there usually are) many positions in the book that are not
95        on a "line" as defined in the previous paragraph. It is convenient to
96        call such positions "isolated" positions. The utility "info-book"
97        counts such isolated positions.
98
99        Some of the isolated positions are provably unreachable and they could
100        in principle be deleted from the book. For example if a book contains
101        only the move "e4" in the starting position but also the position after
102        "d4 d5" then this last position is provably unreachable since it
103        requires white to make a non-book move when a book move is available.
104        Such situations arise frequently from the priority rules in merging
105        books.
106
107        Unfortunately not all isolated positions are provably unreachable and
108        it is difficult to identify the latter. If invoked with "-exact" the
109        utility info-book will attempt to count the isolated positions which
110        require a player to make a non-book move when a book move is available.
111        Due to the possibility of transpositions this is not a fool proof
112        method.
113
114        Epd test mode
115
116        In epd test mode, PolyGlot will search positions in an epd file and
117        record the number of times the right best move was found.  The argu-
118        ments specify when to stop the search in any given position.
119
120        Perft counts
121
122        A perft count is the number of legal move sequence in a given position
123        up to a given depth. PolyGlot can perform such perft counts. It is how-
124        ever much slower than other more dedicated programs.
125
126 OPTIONS
127        When PolyGlot is invoked as an adapter of in epd-test mode it gets its
128        options from a config file and then from the command line.  The default
129        config file is "polyglot.ini" but an alternative one may be optionally
130        included as first argument. The config file format is described below.
131
132        The following engine options may be specified on the command line.
133
134        -noini
135            Do not use a config file, even if one was specified on the command
136            line.
137
138        -pg The argument is a string of the form <name>=<value>. This option
139            will set the Polyglot option <name> to <value>.
140
141        -uci
142            The argument is a string of the form <name>=<value>. This option
143            will set the engine option <name> to <value>.
144
145        -ec This is an alias for -pg "EngineCommand=<value>".
146
147        -ed This is an alias for -pg "EngineDir=<value>".
148
149        -en This is an alias for -pg "EngineName=<value>"
150
151        -hash
152            This is an alias for -uci "Hash=<value>".
153
154        -log
155            This is an alias for -pg "Log=true".
156
157        -lf (default: "polyglot.log")
158            This is an alias for -pg "LogFile=<value>".
159
160        -bk This is an alias for -pg "Book=true" -pg "BookFile=<value>".
161
162        When invoked as
163
164        polyglot make-book
165
166        PolyGlot supports the following options
167
168        -pgn (default: "book.pgn")
169            Input file in pgn format.
170
171        -bin (default: "book.bin")
172            Output file in PolyGlot format.
173
174        -max-ply (default: 1024)
175            Specifies the maximum ply-depth of lines included in the book.
176
177        -min-game (default: 3)
178            Specifies the minimum number of games that have to contain this
179            move for it to be included in the book.
180
181        -min-score (default: 0.0)
182            Specifies the minimum score (or weight) this move should have
183            received for it to  be included in the book. The score is
184            2*(wins)+(draws), globally scaled to fit into 16 bits.
185
186        -only-white
187            Include only moves for white in the book.
188
189        -only-black
190            Include only moves for black in the book.
191
192        -uniform
193            Set all weights to 1. In other words, all moves will be selected
194            with equal probability.
195
196        When invoked as
197
198        polyglot merge-book
199
200        PolyGlot supports the following options
201
202        -in1
203            First input file (in PolyGlot book format).
204
205        -in2
206            Second input file (in PolyGlot book format).
207
208        -out (default: out.bin)
209            Output file (in PolyGlot book format).
210
211        Input files are not symmetrical, "in1" has priority over "in2". In
212        other words when a position occurs both in "in1" and "in2" only the
213        moves and weights from "in1" will be retained in "out".
214
215        When invoked as
216
217        polyglot dump-book
218
219        PolyGlot supports the following options
220
221        -bin (default: book.bin)
222            Input file in PolyGlot book format.
223
224        -color
225            The color for whom to generate the lines.
226
227        -out (default: book_<color>.txt)
228            The name of the output file.
229
230        When invoked as
231
232        polyglot info-book
233
234        PolyGlot supports the following options
235
236        -bin (default: book.bin)
237            Input file in PolyGlot book format.
238
239        -exact
240            Attempt to count the provably unreachable positions among the iso-
241            lated ones.  Note that this takes a very long time.
242
243        When invoked as
244
245        polyglot epd-test
246
247        (possibly with a config file as first argument) PolyGlot supports
248        besides the generic options described above the following additional
249        options.
250
251        -max-depth (default: 63)
252            Unconditionally stop the search when this depth has been reached.
253
254        -max-time (default: 5.0)
255            Unconditionally stop the seach after this amount of time.
256
257        -depth-delta (default: 3)
258            Stop the search if the solution as been found and the best move has
259            been constant for this many depths, on condition that the mininal
260            depth and minimal time have been reached.
261
262        -min-depth (default: 8)
263            Minimal search depth when the search is stopped using
264            "-depth-delta".
265
266        -min-time (default: 1.0)
267            Minimal search time when the search is stopped using
268            "-depth-delta".
269
270        When invoked as
271
272        polyglot perft
273
274        PolyGlot supports the following options
275
276        -fen (default: starting position)
277            Fen at which to start searching.
278
279        -max-depth (default: 1)
280            Maximum depth to search.
281
282 CONFIG FILE FORMAT
283        There should be a different config file for each engine.
284
285        The config file is in the traditional INI format.
286
287            [PolyGLot]
288            option = value
289            ...
290            [Engine]
291            option = value
292            ...
293
294        The characters "#" and ";" serve as comment characters.
295
296        By default initial and final white space is stripped from option val-
297        ues. If you want to avoid this, or if you want use one of the comment
298        characters # or ; in option values (such as for NalimovPath), enclose
299        the value in quotes.
300
301        [PolyGlot] section
302
303        This section is used by PolyGlot only.  The engine is unaware of these
304        options.  The list of available options is detailed below.
305
306        EngineName (default: UCI name)
307            This is the name that will appear in the GUI.  It is cosmetic only.
308            You can use different names for tweaked versions of the same
309            engine.
310
311        EngineDir (default: ".")
312            Full path of the directory where the engine is installed.  You can
313            use "." (without the quotes) if you know that PolyGlot will be
314            launched in the engine directory or the engine is in the "path" and
315            does not need any data file.
316
317        EngineCommand
318            Put here the name of the engine executable file.  You can also add
319            command-line arguments.  Path searching is used and the current
320            directory will be "EngineDir".
321
322        Log (default: false)
323            Whether PolyGlot should log all transactions with the interface and
324            the engine.  This should be necessary only to locate problems.
325
326        LogFile (default: polyglot.log)
327            The name of the log file.  Note that it is put where PolyGlot was
328            launched from, not into the engine directory.
329
330            WARNING: Log files are not cleared between sessions, and can become
331            very large.  It is safe to remove them though.
332
333        Resign (default: false)
334            Set this to "true" if you want PolyGlot to resign on behalf of the
335            engine.
336
337            NOTE: Some engines display buggy scores from time to time although
338            the best move is correct.  Use this option only if you know what
339            you are doing (e.g. you always check the final position of games).
340
341        ResignMoves (default: 3)
342            Number of consecutive moves with "resign" score (see below) before
343            PolyGlot resigns for the engine.  Positions with only one legal
344            move are ignored.
345
346        ResignScore (default: 600)
347            This is the score in centipawns that will trigger resign "count-
348            ing".
349
350        ShowPonder (default: true)
351            Show search information during engine pondering.  Turning this off
352            might be better for interactive use in some interfaces.
353
354        ScoreWhite (default: true)
355            Report score from white's point of view in xboard mode.
356
357        KibitzMove (default: false)
358            Whether to kibitz when playing a move.
359
360        KibitzPV (default: false)
361            Whether to kibitz when the PV is changed (new iteration or new best
362            move).
363
364        KibitzCommand (default: "tellall")
365            xboard command to use for kibitzing, normally "tellall" for kibitz-
366            ing or "tellothers" for whispering.
367
368        KibitzDelay (default: 5)
369            How many seconds to wait before starting kibitzing.  This has an
370            effect only if "KibitzPV" is selected, move kibitzes are always
371            sent regardless of the delay.
372
373        KibitzInterval (default: 0)
374            This is another form of throttling. PolyGlot will usually wait this
375            many seconds before doing the next kibitz.
376
377        UCI (default: false)
378            If true PolyGlot will not understand xboard commands.
379
380        MateScore (default: 10000)
381            Mate score reported to GUI when in xboard mode.
382
383        Book (default: false)
384            Indicates whether a PolyGlot book should be used.  This has no
385            effect on the engine own book (which can be controlled with the UCI
386            option "OwnBook" in the [Engine] section).  In particular, it is
387            possible to use both a PolyGlot book and an engine book.  In that
388            case, the engine book will be used whenever PolyGlot is out of
389            book.  Remember that PolyGlot is unaware of whether the engine is
390            itself using a book or not.
391
392        BookFile (default: book.bin)
393            The name of the (binary) book file.  Note that PolyGlot will look
394            for it in the directory it was launched from, not in the engine
395            directory.  Of course, full path can be used in which case the cur-
396            rent directory does not matter.
397
398        BookRandom (default: true)
399            Select moves according to their weights in the book. If false the
400            move with the highest weight is selected.
401
402        BookRandom (default: true)
403            Select moves according to their weights in the book. If false the
404            move with the highest weight is selected.
405
406        BookDepth (default: 256)
407            Stop using the book after this number of moves.
408
409        BookTreshold (default: 5)
410            Do not play moves with a weight (probability) lower than this (in
411            per mil).
412
413        UseNice (default: false)
414            Run the engine at nice level 5, or "NiceValue" if it set.  On some
415            operating systems it may be necessary to run the engine at lower
416            priority for it to be responsive to commands from PolyGlot while
417            searching.
418
419        NiceValue (default: 5)
420            Nice levels go from -20 to 20 with 20 being the lowest priority.
421            On Unix only root can set negative nice levels. On Windows the
422            standard Win32 priority levels are mapped in a sensible way to Unix
423            nice levels.
424
425        Affinity (default: -1)
426            This a bit vector in which each bit represents the processors that
427            a process is allowed to run on. This option works only on Windows.
428
429        SaveSettingsOnExit (default: true)
430            If true then PolyGlot will implement persistence by loading its
431            options from an additional INI file which is specified by the
432            option "SaveFile". At exit PolyGlot will also save its options to
433            this INI file.
434
435        SaveFile (default: <EngineName>.ini)
436            The name of the file from which to take the additional options.
437
438        Work arounds
439
440        Work arounds are identical to options except that they should be used
441        only when necessary.  Their purpose is to try to hide problems with
442        various software (not just engines).
443
444        IMPORTANT: Any of these work arounds might be removed in future ver-
445        sions of PolyGlot.  You are strongly recommended to contact the author
446        of faulty software and truly fix the problem.
447
448        PolyGlot supports the following work arounds:
449
450        UCIVersion (default: 2)
451            The default value of 2 corresponds to UCI+.  Use 1 to select plain
452            UCI for engines that have problems with UCI+.
453
454        CanPonder (default: false)
455            PolyGlot now conforms to the documented UCI behaviour: the engine
456            will be allowed to ponder only if it (the engine) declares the
457            "Ponder" UCI option.  However some engines which can actually pon-
458            der do not declare the option.  This work around lets PolyGlot know
459            that they can ponder.
460
461        SyncStop (default: false)
462            When a ponder miss occurs, Polyglot interrupts the engine and IMME-
463            DIATELY launches a new search.  While there should be no problem
464            with this, some engines seem confused and corrupt their search
465            board.  "SyncStop" forces PolyGlot to wait for the (now useless)
466            ponder search to finish before launching the new search.
467
468        PromoteWorkAround (default: false)
469            Some engines do not specify a promotion piece, e.g. they send
470            "e7e8" instead of the correct "e7e8q".  This work around enables
471            the incorrect form (and of course promotes into a queen).
472
473        RepeatPV (default: true)
474            When true, PolyGlot repeats the last pv string (which also contains
475            score,depth and time usage) it got from the engine. Some engines
476            however do not send a new pv string just before sending the move.
477            In that case the output of PolyGlot would be inconsistent.  When
478            RepeatPV is false PolyGlot does not repeat the last pv string.  Due
479            to the way kibitzing is implemented, KibitzMove is disabled in that
480            case.
481
482        WbWorkArounds (default: true)
483            The intention of these options is to provide work arounds for
484            xboard/winboard bugs should they arise.  This one decapitalizes the
485            word Draw in options that contain this word. Some versions of
486            xboard/winboard contain a bug which causes such options to be
487            interpreted as draw claims by the engine.
488
489            Engines that send options with "Draw" in their name are Rybka and
490            HIARCS.
491
492        WbWorkArounds2 (default: false)
493            Old version of Winboard clear the engine output window at depth 1.
494            With this work around PG will send info lines at depth >=2. This
495            may or may not improve the display.
496
497        [Engine] section
498
499        This section contains engine UCI options.  PolyGlot does not understand
500        them, but sends the information to the engine at startup (converted to
501        UCI form).  You can add any UCI option that makes sense to the engine
502        (not just the common options about hash-table size and tablebases).
503
504        NOTE: use INI syntax, not UCI.  For example "OwnBook = true" is cor-
505        rect.  It will be replaced by PolyGlot with "setoption name OwnBook
506        value true" at engine startup.
507
508        Standard UCI options are
509
510            Hash
511            NalimovPath
512            NalimovCache
513            OwnBook
514
515        Hidden options like "Ponder" or "UCI_xxx" are automatic and should not
516        be put in an INI file.
517
518        The other options are engine-specific.  Check their name using a UCI
519        GUI or launch the engine in a console and type "uci".
520
521 EXAMPLES
522        Compile "games.pgn" into a book "book.bin" retaining all lines of at
523        most 30 plies.
524
525            polyglot make-book -pgn games.pgn -bin book.bin -max-ply 30
526
527        Merge books "w1.bin" and "w2.bin" into a book "w.bin".
528
529            polyglot merge-book -in1 w1.bin -in2 w2.bin -out w.bin
530
531        Inspect lines for white in "w.bin"
532
533            polyglot dump-book -bin w.bin -color white -out w_white.txt
534
535        Test epd file "test.epd" with a (maximum) search time of 7 minutes per
536        position
537
538            polyglot epd-test -epd test.epd -max-time 420
539
540        The command line for using the UCI engine "fruit" with 128M hash in
541        xboard with logging enabled.
542
543            xboard -fcp "polyglot -noini -log -ec fruit -hash 128"
544
545        The equivalent config file would be:
546
547            [PolyGlot]
548            EngineCommand = fruit
549            Log = true
550            [Engine]
551            Hash=128
552
553 EXIT STATUS
554        PolyGlot always returns 0 on exit.
555
556 AUTHORS
557        Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
558
559        Native Windows port:  Huang Chen<webmaster@elephantbase.net> ("Morning
560        Yellow")
561
562        Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
563
564        UCI port: Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>
565
566 SEE ALSO
567        xboard(6)
568
569
570
571                                   2009-08-31                       POLYGLOT(6)