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 dump-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 solution as been found and the best move has
269 been constant for this many depths, on condition that the mininal
270 depth and minimal time have been reached.
272 =item B<-min-depth> (default: 8)
274 Minimal search depth when the search is stopped using "-depth-delta".
276 =item B<-min-time> (default: 1.0)
278 Minimal search time when the search is stopped using "-depth-delta".
285 =head2 polyglot perft
287 PolyGlot supports the following
292 =item B<-fen> (default: starting position)
294 Fen at which to start searching.
296 =item B<-max-depth> (default: 1)
298 Maximum depth to search.
302 =head1 CONFIG FILE FORMAT
304 There should be a different config file for each engine.
306 The config file is in the traditional INI format.
315 The characters "#" and ";" serve as comment characters.
317 NOTE: There can be spaces in option names or values. Do not use
318 quotes. Boolean values are written as "true" or "false".
320 =head2 [PolyGlot] section
322 This section is used by PolyGlot only. The engine is unaware of these
323 options. The list of available options is detailed below.
327 =item B<EngineName> (default: UCI name)
329 This is the name that will appear in the GUI. It is
330 cosmetic only. You can use different names for tweaked versions of
333 =item B<EngineDir> (default: ".")
335 Full path of the directory where the engine is installed. You can use
336 "." (without the quotes) if you know that PolyGlot will be launched in
337 the engine directory or the engine is in the "path" and does not need
340 =item B<EngineCommand>
342 Put here the name of the engine executable file. You can also add
343 command-line arguments. Path searching is used and the current
344 directory will be "EngineDir".
346 =item B<Log> (default: false)
348 Whether PolyGlot should log all transactions with the interface and
349 the engine. This should be necessary only to locate problems.
351 =item B<LogFile> (default: polyglot.log)
353 The name of the log file. Note that it is put where PolyGlot was
354 launched from, not into the engine directory.
356 WARNING: Log files are not cleared between sessions, and can become
357 very large. It is safe to remove them though.
359 =item B<Resign> (default: false)
361 Set this to "true" if you want PolyGlot to resign on behalf of the
364 NOTE: Some engines display buggy scores from time to time although the
365 best move is correct. Use this option only if you know what you are
366 doing (e.g. you always check the final position of games).
368 =item B<ResignMoves> (default: 3)
370 Number of consecutive moves with "resign" score (see below) before
371 PolyGlot resigns for the engine. Positions with only one legal move
374 =item B<ResignScore> (default: 600)
376 This is the score in centipawns that will trigger resign "counting".
378 =item B<ShowPonder> (default: true)
380 Show search information during engine pondering. Turning this off
381 might be better for interactive use in some interfaces.
383 =item B<ScoreWhite> (default: true)
385 Report score from white's point of view in xboard mode.
387 =item B<KibitzMove> (default: false)
389 Whether to kibitz when playing a move.
391 =item B<KibitzPV> (default: false)
393 Whether to kibitz when the PV is changed (new iteration or new best move).
395 =item B<KibitzCommand> (default: "tellall")
397 xboard command to use for kibitzing, normally "tellall" for kibitzing
398 or "tellothers" for whispering.
400 =item B<KibitzDelay> (default: 5)
402 How many seconds to wait before starting kibitzing. This has an
403 effect only if "KibitzPV" is selected, move kibitzes are always sent
404 regardless of the delay.
406 =item B<KibitzInterval> (default: 0)
408 This is another form of throttling. PolyGlot will usually wait this
409 many seconds before doing the next kibitz.
411 =item B<UCI> (default: false)
413 If true PolyGlot will not understand xboard commands.
415 =item B<Chess960> (default: false)
417 Play Chess960 (also called Fischer Random Chess or FRC),
419 =item B<MateScore> (default: 10000)
421 Mate score reported to GUI when in xboard mode.
423 =item B<Book> (default: false)
425 Indicates whether a PolyGlot book should be used. This has no effect
426 on the engine own book (which can be controlled with the UCI option
427 "OwnBook" in the [Engine] section). In particular, it is possible to
428 use both a PolyGlot book and an engine book. In that case, the engine
429 book will be used whenever PolyGlot is out of book. Remember that
430 PolyGlot is unaware of whether the engine is itself using a book or
433 =item B<BookFile> (default: book.bin)
435 The name of the (binary) book file. Note that PolyGlot will look for
436 it in the directory it was launched from, not in the engine directory.
437 Of course, full path can be used in which case the current directory
440 =item B<BookRandom> (default: true)
442 Select moves according to their weights in the book. If false the move
443 with the highest weight is selected.
445 =item B<BookRandom> (default: true)
447 Select moves according to their weights in the book. If false the move
448 with the highest weight is selected.
450 =item B<BookDepth> (default: 256)
452 Stop using the book after this number of moves.
454 =item B<BookTreshold> (default: 5)
456 Do not play moves with a weight (probability) lower than this (in per mil).
458 =item B<UseNice> (default: false)
460 Run the engine at nice level 5, or "NiceValue" if it set. On some
461 operating systems it may be necessary to run the engine at lower
462 priority for it to be responsive to commands from PolyGlot while
465 =item B<NiceValue> (default: 5)
467 Nice levels go from -20 to 20 with 20 being the lowest priority.
468 On Unix only root can set negative nice levels. On Windows the standard
469 Win32 priority levels are mapped in a sensible way to Unix nice levels.
472 =item B<Affinity> (default: -1)
474 This a bit vector in which each bit represents the processors that a
475 process is allowed to run on. This option works only on Windows.
482 Work arounds are identical to options except that they should be used
483 only when necessary. Their purpose is to try to hide problems with
484 various software (not just engines).
486 IMPORTANT: Any of these work arounds might be removed in future
487 versions of PolyGlot. You are strongly recommended to contact the
488 author of faulty software and truly fix the problem.
490 PolyGlot supports the following work arounds:
494 =item B<UCIVersion> (default: 2)
496 The default value of 2 corresponds to UCI+. Use 1 to select plain
497 UCI for engines that have problems with UCI+.
499 =item B<CanPonder> (default: false)
501 PolyGlot now conforms to the documented UCI behaviour: the engine will
502 be allowed to ponder only if it (the engine) declares the "Ponder" UCI
503 option. However some engines which can actually ponder do not declare
504 the option. This work around lets PolyGlot know that they can ponder.
506 =item B<SyncStop> (default: false)
508 When a ponder miss occurs, Polyglot interrupts the engine and
509 IMMEDIATELY launches a new search. While there should be no problem
510 with this, some engines seem confused and corrupt their search board.
511 "SyncStop" forces PolyGlot to wait for the (now useless) ponder search
512 to finish before launching the new search.
514 =item B<PromoteWorkAround> (default: false)
516 Some engines do not specify a promotion piece, e.g. they send "e7e8"
517 instead of the correct "e7e8q". This work around enables the
518 incorrect form (and of course promotes into a queen).
520 =item B<RepeatPV> (default: true)
522 When true, PolyGlot repeats the last pv string (which also contains
523 score,depth and time usage) it got from the engine. Some engines
524 however do not send a new pv string just before sending the move.
525 In that case the output of PolyGlot would be inconsistent.
526 When RepeatPV is false PolyGlot does not repeat the last pv string.
527 Due to the way kibitzing is implemented, KibitzMove is disabled in that case.
529 =item B<WbWorkArounds> (default: true)
531 The intention of these options is to provide work arounds for
532 xboard/winboard bugs should they arise. This one decapitalizes
533 the word Draw in options that contain this word. Some versions of
534 xboard/winboard contain a bug which causes such options to be
535 interpreted as draw claims by the engine.
537 Engines that send options with "Draw" in their name are Rybka and HIARCS.
539 =item B<WbWorkArounds2> (default: false)
541 Old version of Winboard clear the engine output window at depth 1. With this
542 work around PG will send info lines at depth >=2. This may or may not improve
548 =head2 [Engine] section
550 This section contains engine UCI options. PolyGlot does not
551 understand them, but sends the information to the engine at startup
552 (converted to UCI form). You can add any UCI option that makes sense
553 to the engine (not just the common options about hash-table size and
556 NOTE: use INI syntax, not UCI. For example "OwnBook = true" is
557 correct. It will be replaced by PolyGlot with "setoption name OwnBook
558 value true" at engine startup.
560 Standard UCI options are
567 Hidden options like "Ponder" or "UCI_xxx" are automatic
568 and should not be put in an INI file.
570 The other options are engine-specific. Check their name using a UCI
571 GUI or launch the engine in a console and type "uci".
575 Compile "games.pgn" into a book "book.bin" retaining all lines of at
578 polyglot make-book -pgn games.pgn -bin book.bin -max-ply 30
580 Merge books "w1.bin" and "w2.bin" into a book "w.bin".
582 polyglot merge-book -in1 w1.bin -in2 w2.bin -out w.bin
584 Inspect lines for white in "w.bin"
586 polyglot dump-book -bin w.bin -color white -out w_white.txt
588 Test epd file "test.epd" with a (maximum) search time of 7 minutes per position
590 polyglot epd-test -epd test.epd -max-time 420
592 The command line for using the UCI engine "fruit" in a GUI which uses the
597 The equivalent config file:
600 EngineCommand = fruit
606 PolyGlot always returns 0 on exit.
610 Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
612 Native Windows port: Huang Chen<webmaster@elephantbase.net> ("Morning Yellow")
614 Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
616 UCI port: Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>