version 1.4.53b
[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        -log (default: false)
152            This is an alias for -pg "Log=<value>"
153
154        -lf (default: "polyglot.log")
155            This is an alias for -pg "LogFile=<value>".
156
157        -wb (default: "true")
158            This is an alias for -pg "OnlyWbOptions=<value>".
159
160        When invoked as
161
162        polyglot make-book
163
164        PolyGlot supports the following options
165
166        -pgn (default: "book.pgn")
167            Input file in pgn format.
168
169        -bin (default: "book.bin")
170            Output file in PolyGlot format.
171
172        -max-ply (default: 1024)
173            Specifies the maximum ply-depth of lines included in the book.
174
175        -min-game (default: 3)
176            Specifies the minimum number of games that have to contain this
177            move for it to be included in the book.
178
179        -min-score (default: 0.0)
180            Specifies the minimum score (or weight) this move should have
181            received for it to  be included in the book. The score is
182            2*(wins)+(draws), globally scaled to fit into 16 bits.
183
184        -only-white
185            Include only moves for white in the book.
186
187        -only-black
188            Include only moves for black in the book.
189
190        -uniform
191            Set all weights to 1. In other words, all moves will be selected
192            with equal probability.
193
194        When invoked as
195
196        polyglot merge-book
197
198        PolyGlot supports the following options
199
200        -in1
201            First input file (in PolyGlot book format).
202
203        -in2
204            Second input file (in PolyGlot book format).
205
206        -out (default: out.bin)
207            Output file (in PolyGlot book format).
208
209        Input files are not symmetrical, "in1" has priority over "in2". In
210        other words when a position occurs both in "in1" and "in2" only the
211        moves and weights from "in1" will be retained in "out".
212
213        When invoked as
214
215        polyglot dump-book
216
217        PolyGlot supports the following options
218
219        -bin (default: book.bin)
220            Input file in PolyGlot book format.
221
222        -color
223            The color for whom to generate the lines.
224
225        -out (default: book_<color>.txt)
226            The name of the output file.
227
228        When invoked as
229
230        polyglot info-book
231
232        PolyGlot supports the following options
233
234        -bin (default: book.bin)
235            Input file in PolyGlot book format.
236
237        -exact
238            Attempt to count the provably unreachable positions among the iso-
239            lated ones.  Note that this takes a very long time.
240
241        When invoked as
242
243        polyglot epd-test
244
245        (possibly with a config file as first argument) PolyGlot supports
246        besides the generic options described above the following additional
247        options.
248
249        -max-depth (default: 63)
250            Unconditionally stop the search when this depth has been reached.
251
252        -max-time (default: 5.0)
253            Unconditionally stop the seach after this amount of time.
254
255        -depth-delta (default: 3)
256            Stop the search if the solution as been found and the best move has
257            been constant for this many depths, on condition that the mininal
258            depth and minimal time have been reached.
259
260        -min-depth (default: 8)
261            Minimal search depth when the search is stopped using
262            "-depth-delta".
263
264        -min-time (default: 1.0)
265            Minimal search time when the search is stopped using
266            "-depth-delta".
267
268        When invoked as
269
270        polyglot perft
271
272        PolyGlot supports the following options
273
274        -fen (default: starting position)
275            Fen at which to start searching.
276
277        -max-depth (default: 1)
278            Maximum depth to search.
279
280 CONFIG FILE FORMAT
281        There should be a different config file for each engine.
282
283        The config file is in the traditional INI format.
284
285            [PolyGLot]
286            option = value
287            ...
288            [Engine]
289            option = value
290            ...
291
292        The characters "#" and ";" serve as comment characters.
293
294        By default initial and final white space is stripped from option val-
295        ues. If you want to avoid this, or if you want use one of the comment
296        characters # or ; in option values (such as for NalimovPath), enclose
297        the value in quotes.
298
299        [PolyGlot] section
300
301        This section is used by PolyGlot only.  The engine is unaware of these
302        options.  The list of available options is detailed below.
303
304        EngineName (default: UCI name)
305            This is the name that will appear in the GUI.  It is cosmetic only.
306            You can use different names for tweaked versions of the same
307            engine.
308
309        EngineDir (default: ".")
310            Full path of the directory where the engine is installed.  You can
311            use "." (without the quotes) if you know that PolyGlot will be
312            launched in the engine directory or the engine is in the "path" and
313            does not need any data file.
314
315        EngineCommand
316            Put here the name of the engine executable file.  You can also add
317            command-line arguments.  Path searching is used and the current
318            directory will be "EngineDir".
319
320        SettingsDir (default: $HOME/.polyglot on Linux; ".\_PG" on Windows)
321            The directory where ini files are stored for engines that are
322            started with -noini. Such ini files may be created by pushing the
323            "Save" button in the Engine settings dialog in WB/XB 4.4.0 and
324            higher. As a special exception (for WB/XB 4.4.0 compatibility) this
325            directory is also used in case PolyGlot is started with config
326            files named "polyglot_1st.ini" or "polyglot_2nd.ini".
327
328        Log (default: false)
329            Whether PolyGlot should log all transactions with the interface and
330            the engine.  This should be necessary only to locate problems.
331
332        LogFile (default: polyglot.log)
333            The name of the log file.  Note that it is put where PolyGlot was
334            launched from, not into the engine directory.
335
336            WARNING: Log files are not cleared between sessions, and can become
337            very large.  It is safe to remove them though.
338
339        Resign (default: false)
340            Set this to "true" if you want PolyGlot to resign on behalf of the
341            engine.
342
343            NOTE: Some engines display buggy scores from time to time although
344            the best move is correct.  Use this option only if you know what
345            you are doing (e.g. you always check the final position of games).
346
347        ResignMoves (default: 3)
348            Number of consecutive moves with "resign" score (see below) before
349            PolyGlot resigns for the engine.  Positions with only one legal
350            move are ignored.
351
352        ResignScore (default: 600)
353            This is the score in centipawns that will trigger resign "count-
354            ing".
355
356        ShowPonder (default: true)
357            Show search information during engine pondering.  Turning this off
358            might be better for interactive use in some interfaces.
359
360        ScoreWhite (default: true)
361            Report score from white's point of view in xboard mode.
362
363        KibitzMove (default: false)
364            Whether to kibitz when playing a move.
365
366        KibitzPV (default: false)
367            Whether to kibitz when the PV is changed (new iteration or new best
368            move).
369
370        KibitzCommand (default: "tellall")
371            xboard command to use for kibitzing, normally "tellall" for kibitz-
372            ing or "tellothers" for whispering.
373
374        KibitzDelay (default: 5)
375            How many seconds to wait before starting kibitzing.  This has an
376            effect only if "KibitzPV" is selected, move kibitzes are always
377            sent regardless of the delay.
378
379        KibitzInterval (default: 0)
380            This is another form of throttling. PolyGlot will usually wait this
381            many seconds before doing the next kibitz.
382
383        UCI (default: false)
384            If true PolyGlot will not understand xboard commands.
385
386        MateScore (default: 10000)
387            Mate score reported to GUI when in xboard mode.
388
389        Book (default: false)
390            Indicates whether a PolyGlot book should be used.  This has no
391            effect on the engine own book (which can be controlled with the UCI
392            option "OwnBook" in the [Engine] section).  In particular, it is
393            possible to use both a PolyGlot book and an engine book.  In that
394            case, the engine book will be used whenever PolyGlot is out of
395            book.  Remember that PolyGlot is unaware of whether the engine is
396            itself using a book or not.
397
398        BookFile (default: book.bin)
399            The name of the (binary) book file.  Note that PolyGlot will look
400            for it in the directory it was launched from, not in the engine
401            directory.  Of course, full path can be used in which case the cur-
402            rent directory does not matter.
403
404        BookRandom (default: true)
405            Select moves according to their weights in the book. If false the
406            move with the highest weight is selected.
407
408        BookLearn (default: false)
409            Store learning information in the book (which must be writable).
410            Currently no engine actually uses this information.
411
412        BookDepth (default: 256)
413            Stop using the book after this number of moves.
414
415        BookTreshold (default: 5)
416            Do not play moves with a weight (probability) lower than this (in
417            per mil).
418
419        UseNice (default: false)
420            Run the engine at nice level 5, or "NiceValue" if it set.  On some
421            operating systems it may be necessary to run the engine at lower
422            priority for it to be responsive to commands from PolyGlot while
423            searching.
424
425        NiceValue (default: 5)
426            Nice levels go from -20 to 20 with 20 being the lowest priority.
427            On Unix only root can set negative nice levels. On Windows the
428            standard Win32 priority levels are mapped in a sensible way to Unix
429            nice levels.
430
431        Affinity (default: -1)
432            This a bit vector in which each bit represents the processors that
433            a process is allowed to run on. This option works only on Windows.
434
435        OnlyWbOptions (default: true)
436            If true then PolyGlot restricts the options it sends to those that
437            are potentially useful for WinBoard.
438
439        Work arounds
440
441        Work arounds are identical to options except that they should be used
442        only when necessary.  Their purpose is to try to hide problems with
443        various software (not just engines).
444
445        IMPORTANT: Any of these work arounds might be removed in future ver-
446        sions of PolyGlot.  You are strongly recommended to contact the author
447        of faulty software and truly fix the problem.
448
449        PolyGlot supports the following work arounds:
450
451        UCIVersion (default: 2)
452            The default value of 2 corresponds to UCI+.  Use 1 to select plain
453            UCI for engines that have problems with UCI+.
454
455        CanPonder (default: false)
456            PolyGlot now conforms to the documented UCI behaviour: the engine
457            will be allowed to ponder only if it (the engine) declares the
458            "Ponder" UCI option.  However some engines which can actually pon-
459            der do not declare the option.  This work around lets PolyGlot know
460            that they can ponder.
461
462        SyncStop (default: false)
463            When a ponder miss occurs, Polyglot interrupts the engine and IMME-
464            DIATELY launches a new search.  While there should be no problem
465            with this, some engines seem confused and corrupt their search
466            board.  "SyncStop" forces PolyGlot to wait for the (now useless)
467            ponder search to finish before launching the new search.
468
469        PromoteWorkAround (default: false)
470            Some engines do not specify a promotion piece, e.g. they send
471            "e7e8" instead of the correct "e7e8q".  This work around enables
472            the incorrect form (and of course promotes into a queen).
473
474        RepeatPV (default: true)
475            When true, PolyGlot repeats the last pv string (which also contains
476            score,depth and time usage) it got from the engine. Some engines
477            however do not send a new pv string just before sending the move.
478            In that case the output of PolyGlot would be inconsistent.  When
479            RepeatPV is false PolyGlot does not repeat the last pv string.  Due
480            to the way kibitzing is implemented, KibitzMove is disabled in that
481            case.
482
483        [Engine] section
484
485        This section contains engine UCI options.  PolyGlot does not understand
486        them, but sends the information to the engine at startup (converted to
487        UCI form).  You can add any UCI option that makes sense to the engine
488        (not just the common options about hash-table size and tablebases).
489
490        NOTE: use INI syntax, not UCI.  For example "OwnBook = true" is cor-
491        rect.  It will be replaced by PolyGlot with "setoption name OwnBook
492        value true" at engine startup.
493
494        Standard UCI options are
495
496            Hash
497            NalimovPath
498            NalimovCache
499            OwnBook
500
501        Hidden options like "Ponder" or "UCI_xxx" are automatic and should not
502        be put in an INI file.
503
504        The other options are engine-specific.  Check their name using a UCI
505        GUI or launch the engine in a console and type "uci".
506
507 EXAMPLES
508        Running the UCI engine "fruit" under xboard 4.3.15 and later (this
509        invokes PolyGlot internally).
510
511            xboard -fcp fruit -fUCI
512
513        An explicit command line for using the UCI engine "fruit" with 128M
514        hash in xboard with logging enabled (this also works on xboard 4.2.7).
515
516            xboard -fcp "polyglot -noini -log -ec fruit -hash 128"
517
518        The equivalent config file would be:
519
520            [PolyGlot]
521            EngineCommand = fruit
522            Log = true
523            [Engine]
524            Hash=128
525
526        Compile "games.pgn" into a book "book.bin" retaining all lines of at
527        most 30 plies.
528
529            polyglot make-book -pgn games.pgn -bin book.bin -max-ply 30
530
531        Merge books "w1.bin" and "w2.bin" into a book "w.bin".
532
533            polyglot merge-book -in1 w1.bin -in2 w2.bin -out w.bin
534
535        Inspect lines for white in "w.bin"
536
537            polyglot dump-book -bin w.bin -color white -out w_white.txt
538
539        Test epd file "test.epd" with a (maximum) search time of 7 minutes per
540        position
541
542            polyglot epd-test -epd test.epd -max-time 420
543
544 EXIT STATUS
545        PolyGlot always returns 0 on exit.
546
547 AUTHORS
548        Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
549
550        Native Windows port:  Huang Chen<webmaster@elephantbase.net> ("Morning
551        Yellow")
552
553        Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
554
555        UCI port and implementation of new WB protocol: Michel Van den Bergh
556        <michel.vandenbergh(at)uhasselt.be>
557
558 SEE ALSO
559        xboard(6)
560
561
562
563                                   2009-09-11                       POLYGLOT(6)