3 PolyGlot - Winboard protocol to UCI protocol adapter
4 - book engine for Polyglot books
5 - a collection of utilities for creating and analyzing opening books
6 - a utility for analyzing epd files
15 polyglot make-book [-pgn inputfile] [-bin outputfile] [-max-ply ply] [-min-game games] [-min-score score] [-only-white] [-only-black] [-uniform]
17 polyglot merge-book -in1 inputfile1 -in2 inputfile2 [-out outputfile]
19 polyglot info-book [-bin inputfile] [-exact]
21 polyglot dumb-book [-bin inputfile] -color color [-out outputfile]
23 polyglot [configfile] epd-test [-epd inputfile] [-min-depth depth] [-max-depth depth] [-max-time time] [-depth-delta delta]
25 polyglot perft [-fen fen] [-max-depth depth]
29 =head2 PolyGlot as adapter and book engine
31 PolyGlot is a "UCI adapter". It connects a GUI interface (such as
32 XBoard, Winboard, Arena or Chessbase) to a UCI chess engine.
34 By specifying an opening book (in PolyGlot book format) chess engines can
35 transparently use such books.
37 PolyGlot understands the two main GUI protocols: UCI and
38 xboard. Normally the protocol will be auto detected but this can be
39 overridden in the configuration file.
41 In xboard mode PolyGlot fully translates between the xboard and UCI protocols.
42 In addition it tries to solve known problems with other adapters.
43 For instance, it detects and reports draws by fifty-move rule,
44 repetition, etc ... It also supports Chess960.
46 When in UCI mode PolyGlot mostly passes commands from the GUI
47 to the engine and vice versa, except that it will play book moves on
48 behalf of the engine when the occasion arises.
50 The engine options are exported as UCI options in UCI
51 mode and as "feature option=" commands in xboard mode. The latter form
52 an extension of the xboard protocol as defined by H.G. Muller.
54 Options which normally appear in the [PolyGlot] section of the
55 config file (see below) are exported as options with their name prefixed
56 by "Polyglot". This makes it easy to filter them in the GUI.
58 NOTE: Not all options are exported, only those that make sense in the
61 =head2 Book making utilities
63 PolyGlot supports the "PolyGlot opening book format". This is the
64 defacto standard non-proprietary opening book format. It is fully documented
67 http://alpha.uhasselt.be/Research/Algebra/Toga/book_format.html
69 Roughly speaking a PolyGlot opening book is a collection of triples
70 (position, move, weight). A "position" is represented by a 64-bit
71 Zobrist hash key. The weight is proportional to the probability the move should
74 Other opening book formats such as ChessBase's .ctg format and Arena's
75 .abk format are undocumented and proprietary. They can only be used
78 PolyGlot can compile a pgn file into a binary PolyGlot book and furthermore
79 it can merge two such binary books into a third one.
81 PolyGlot can also extract some useful information from PolyGlot books. The utility
82 "dump-book" dumps the "lines" in a book for a given color. By definition
83 a line is a sequence of moves (from the starting position) in which
84 the given color makes only book moves and the other color makes
85 arbitrary moves (i.e. not necessarily book moves).
87 Since a PolyGlot book is built up from positions and not lines there
88 may be (and there usually are) many positions in the book that are not
89 on a "line" as defined in the previous paragraph. It is convenient
90 to call such positions "isolated" positions. The utility "info-book"
91 counts such isolated positions.
93 Some of the isolated positions are provably unreachable and they
94 could in principle be deleted from the book. For example if a book
95 contains only the move "e4" in the starting position but also the
96 position after "d4 d5" then this last position is provably unreachable
97 since it requires white to make a non-book move when a book move is
98 available. Such situations arise frequently from the priority rules
101 Unfortunately not all isolated positions are provably unreachable and
102 it is difficult to identify the latter. If invoked with "-exact" the
103 utility info-book will attempt to count the isolated positions which
104 require a player to make a non-book move when a book move is available.
105 Due to the possibility of transpositions this is not a fool proof method.
109 In epd test mode, PolyGlot will search positions in an epd file and
110 record the number of times the right best move was found. The
111 arguments specify when to stop the search in any given position.
115 A perft count is the number of legal move sequence in a given position
116 up to a given depth. PolyGlot can perform such perft counts. It
117 is however much slower than other more dedicated programs.
121 When invoked without options or with a config file as argument PolyGlot
122 acts as an adapter. The config file format is documented below. The
123 default config file is "polyglot.ini".
127 =head2 polyglot -ec engine
129 PolyGlot simply starts "engine" and acts as an adapter. No config file
130 is used and thus it is expected that all properties will be set by the
135 =head2 polyglot make-book
137 PolyGlot supports the following options
141 =item B<-pgn> (default: "book.pgn")
143 Input file in pgn format.
145 =item B<-bin> (default: "book.bin")
147 Output file in PolyGlot format.
149 =item B<-max-ply> (default: 1024)
151 Specifies the maximum ply-depth of lines included in the book.
153 =item B<-min-game> (default: 3)
155 Specifies the minimum number of games that have to contain this move for it to be included in the book.
157 =item B<-min-score> (default: 0.0)
159 Specifies the minimum score (or weight) this move should have received for
160 it to be included in the book. The score is 2*(wins)+(draws), globally scaled
165 Include only moves for white in the book.
169 Include only moves for black in the book.
173 Set all weights to 1. In other words, all moves will be selected with
181 =head2 polyglot merge-book
183 PolyGlot supports the following options
189 First input file (in PolyGlot book format).
193 Second input file (in PolyGlot book format).
195 =item B<-out> (default: out.bin)
197 Output file (in PolyGlot book format).
201 Input files are not symmetrical, "in1" has priority over "in2". In other
202 words when a position occurs both in "in1" and "in2" only the
203 moves and weights from "in1" will be retained in "out".
208 =head2 polyglot dump-book
210 PolyGlot supports the following options
214 =item B<-bin> (default: book.bin)
216 Input file in PolyGlot book format.
220 The color for whom to generate the lines.
222 =item B<-out> (default: book_<color>.txt)
224 The name of the output file.
231 =head2 polyglot info-book
233 PolyGlot supports the following options
237 =item B<-bin> (default: book.bin)
239 Input file in PolyGlot book format.
243 Attempt to count the provably unreachable positions among the isolated ones.
244 Note that this takes a very long time.
250 =head2 polyglot epd-test
252 (possibly with a config file as first argument) PolyGlot supports the following
257 =item B<-max-depth> (default: 63)
259 Unconditionally stop the search when this depth has
262 =item B<-max-time> (default: 5.0)
264 Unconditionally stop the seach after this amount of time.
266 =item B<-depth-delta> (default: 3)
268 Stop the search if the best move has been constant for this many depths,
269 on condition that the mininal depth and minimal time have been reached.
271 =item B<-min-depth> (default: 8)
273 Minimal search depth when the search is stopped using "-depth-delta".
275 =item B<-min-time> (default: 1.0)
277 Minimal search time when the search is stopped using "-depth-delta".
284 =head2 polyglot perft
286 PolyGlot supports the following
291 =item B<-fen> (default: starting position)
293 Fen at which to start searching.
295 =item B<-max-depth> (default: 1)
297 Maximum depth to search.
301 =head1 CONFIG FILE FORMAT
303 There should be a different config file for each engine.
305 The config file is in the traditional INI format.
314 Lines starting with "#" are ignored.
316 NOTE: There can be spaces in option names or values. Do not use
317 quotes. Boolean values are written as "true" or "false".
319 =head2 [PolyGlot] section
321 This section is used by PolyGlot only. The engine is unaware of these
322 options. The list of available options is detailed below.
326 =item B<EngineName> (default: UCI name)
328 This is the name that will appear in the GUI. It is
329 cosmetic only. You can use different names for tweaked versions of
332 =item B<EngineDir> (default: ".")
334 Full path of the directory where the engine is installed. You can use
335 "." (without the quotes) if you know that PolyGlot will be launched in
336 the engine directory or the engine is in the "path" and does not need
339 =item B<EngineCommand>
341 Put here the name of the engine executable file. You can also add
342 command-line arguments. Path searching is used and the current
343 directory will be "EngineDir".
345 =item B<Log> (default: false)
347 Whether PolyGlot should log all transactions with the interface and
348 the engine. This should be necessary only to locate problems.
350 =item B<LogFile> (default: polyglot.log)
352 The name of the log file. Note that it is put where PolyGlot was
353 launched from, not into the engine directory.
355 WARNING: Log files are not cleared between sessions, and can become
356 very large. It is safe to remove them though.
358 =item B<Resign> (default: false)
360 Set this to "true" if you want PolyGlot to resign on behalf of the
363 NOTE: Some engines display buggy scores from time to time although the
364 best move is correct. Use this option only if you know what you are
365 doing (e.g. you always check the final position of games).
367 =item B<ResignMoves> (default: 3)
369 Number of consecutive moves with "resign" score (see below) before
370 PolyGlot resigns for the engine. Positions with only one legal move
373 =item B<ResignScore> (default: 600)
375 This is the score in centipawns that will trigger resign "counting".
377 =item B<ShowPonder> (default: true)
379 Show search information during engine pondering. Turning this off
380 might be better for interactive use in some interfaces.
382 =item B<KibitzMove> (default: false)
384 Whether to kibitz when playing a move.
386 =item B<KibitzPV> (default: false)
388 Whether to kibitz when the PV is changed (new iteration or new best move).
390 =item B<KibitzCommand> (default: "tellall")
392 xboard command to use for kibitzing, normally "tellall" for kibitzing
393 or "tellothers" for whispering.
396 =item B<KibitzDelay> (default: 5)
398 How many seconds to wait before starting kibitzing. This has an
399 effect only if "KibitzPV" is selected, move kibitzes are always sent
400 regardless of the delay.
402 =item B<UCI> (default: false)
404 If true PolyGlot will not understand xboard commands.
406 =item B<Chess960> (default: false)
408 Play Chess960 (also called Fischer Random Chess or FRC),
410 =item B<MateScore> (default: 10000)
412 Mate score reported to GUI when in xboard mode.
414 =item B<Book> (default: false)
416 Indicates whether a PolyGlot book should be used. This has no effect
417 on the engine own book (which can be controlled with the UCI option
418 "OwnBook" in the [Engine] section). In particular, it is possible to
419 use both a PolyGlot book and an engine book. In that case, the engine
420 book will be used whenever PolyGlot is out of book. Remember that
421 PolyGlot is unaware of whether the engine is itself using a book or
424 =item B<BookFile> (default: book.bin)
426 The name of the (binary) book file. Note that PolyGlot will look for
427 it in the directory it was launched from, not in the engine directory.
428 Of course, full path can be used in which case the current directory
431 =item B<BookRandom> (default: true)
433 Select moves according to their weights in the book. If false the move
434 with the highest weight is selected.
436 =item B<BookLearn> (default: false)
438 Record learning information in the opening book. Naturally this requires
439 the opening book to be writable.
441 =item B<UseNice> (default: false)
443 Run the engine at nice level 5, or "NiceValue" if it set. On some
444 operating systems it may be necessary to run the engine at lower
445 priority for it to be responsive to commands from PolyGlot while
448 =item B<NiceValue> (default: 5)
450 Nice levels go from -20 to 20 with 20 being the lowest priority.
451 On Unix only root can set negative nice levels. On Windows the standard
452 Win32 priority levels are mapped in a sensible way to Unix nice levels.
455 =item B<Affinity> (default: -1)
457 This a bit vector in which each bit represents the processors that a
458 process is allowed to run on. This option works only on Windows.
465 Work arounds are identical to options except that they should be used
466 only when necessary. Their purpose is to try to hide problems with
467 various software (not just engines). The default value is always
468 correct for bug-free software.
470 IMPORTANT: Any of these work arounds might be removed in future
471 versions of PolyGlot. You are strongly recommended to contact the
472 author of faulty software and truly fix the problem.
474 PolyGlot supports the following work arounds:
478 =item B<UCIVersion> (default: 2)
480 The default value of 2 corresponds to UCI+. Use 1 to select plain
481 UCI for engines that have problems with UCI+.
483 =item B<CanPonder> (default: false)
485 PolyGlot now conforms to the documented UCI behaviour: the engine will
486 be allowed to ponder only if it (the engine) declares the "Ponder" UCI
487 option. However some engines which can actually ponder do not declare
488 the option. This work around lets PolyGlot know that they can ponder.
490 =item B<SyncStop> (default: false)
492 When a ponder miss occurs, Polyglot interrupts the engine and
493 IMMEDIATELY launches a new search. While there should be no problem
494 with this, some engines seem confused and corrupt their search board.
495 "SyncStop" forces PolyGlot to wait for the (now useless) ponder search
496 to finish before launching the new search.
498 =item B<PromoteWorkAround> (default: false)
500 Some engines do not specify a promotion piece, e.g. they send "e7e8"
501 instead of the correct "e7e8q". This work around enables the
502 incorrect form (and of course promotes into a queen).
504 =item B<RepeatPV> (default: true)
506 When true, PolyGlot repeats the last pv string (which also contains
507 score,depth and time usage) it got from the engine. Some engines
508 however do not send a new pv string just before sending the move and
509 the now old pv string might confuse debugtools that parse the winboard
516 =head2 [Engine] section
518 This section contains engine UCI options. PolyGlot does not
519 understand them, but sends the information to the engine at startup
520 (converted to UCI form). You can add any UCI option that makes sense
521 to the engine (not just the common options about hash-table size and
524 NOTE: use INI syntax, not UCI. For example "OwnBook = true" is
525 correct. It will be replaced by PolyGlot with "setoption name OwnBook
526 value true" at engine startup.
528 Standard UCI options are
535 Hidden options like "Ponder" or "UCI_xxx" are automatic
536 and should not be put in an INI file.
538 The other options are engine-specific. Check their name using a UCI
539 GUI or launch the engine in a console and type "uci".
543 Compile "games.pgn" into a book "book.bin" retaining all lines of at
546 polyglot make-book -pgn games.pgn -bin book.bin -max-ply 30
548 Merge books "in1.bin" and "in2.bin" into a book "out.bin".
550 polyglot merge-book -in1 w1.bin -in2 w2.bin -out w.bin
552 The command line for using the UCI engine "fruit" in a GUI which uses the
557 The equivalent config file:
560 EngineCommand = fruit
566 PolyGlot always returns 0 on exit.
570 Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
572 Native Windows port: Huang Chen<webmaster@elephantbase.net> ("Morning Yellow")
574 Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
576 UCI port: Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>