3 PolyGlot - Winboard protocol to UCI protocol adapter
4 - book engine for Polyglot books
5 - a collection of utilities for creating opening books
6 - a utility for analyzing epd files
13 polyglot make-book [-pgn inputfile] [-bin outputfile] [-max-ply ply] [-min-game games] [-min-score score] [-only-white] [-only-black] [-uniform]
15 polyglot merge-book -in1 inputfile1 -in2 inputfile2 [-out outputfile]
17 polyglot [configfile] epd-test [-epd inputfile] [-min-depth depth] [-max-depth depth] [-max-time time] [-depth-delta delta]
19 polyglot perft [-fen fen] [-max-depth depth]
23 =head2 PolyGlot as adapter and book engine
25 PolyGlot is a "UCI adapter". It connects a GUI interface (such as
26 XBoard, Winboard, Arena or Chessbase) to a UCI chess engine.
28 By specifying an opening book (in PolyGlot book format) chess engines can
29 transparently use such books.
31 PolyGlot understands the two main GUI protocols: UCI and
32 xboard. Normally the protocol will be auto detected but this can be
33 overridden in the configuration file.
35 In xboard mode PolyGlot fully translates between the xboard and UCI protocols.
36 In addition it tries to solve known problems with other adapters.
37 For instance, it detects and reports draws by fifty-move rule,
38 repetition, etc ... It also supports Chess960.
40 When in UCI mode PolyGlot mostly passes commands from the GUI
41 to the engine and vice versa, except that it will play book moves on
42 behalf of the engine when the occasion arises.
44 =head2 Book making utilities
46 PolyGlot supports the "PolyGlot opening book format". This is the
47 defacto standard non-proprietary opening book format. It is fully documented
50 http://alpha.uhasselt.be/Research/Algebra/Toga/book_format.html
52 Roughly speaking a PolyGlot opening book is a collection of triples
53 (position, move, weight). A "position" is represented by a 64-bit
54 Zobrist hash key. The weight is proportional to the probability the move should
57 Other opening book formats such as ChessBase's .ctg format and Arena's
58 .abk format are undocumented and proprietary. They can only be used
61 PolyGlot can compile a pgn file into a binary PolyGlot book and furthermore
62 it can merge two such binary books into a third one.
66 In epd test mode, PolyGlot will search positions in an epd file and
67 record the number of times the right best move was found. The
68 arguments specify when to stop the search in any given position.
72 A perft count is the number of legal move sequence in a given position
73 up to a given depth. PolyGlot can perform such perft counts. It
74 is however much slower than other more dedicated programs.
78 When invoked without options or with a config file as argument PolyGlot
79 acts as an adapter. The config file format is documented below. The
80 default config file is "polyglot.ini".
84 =head2 polyglot make-book
86 PolyGlot supports the following options
90 =item B<-pgn> (default: "book.pgn")
92 Input file in pgn format.
94 =item B<-bin> (default: "book.bin")
96 Output file in PolyGlot format.
98 =item B<-max-ply> (default: 1024)
100 Specifies the maximum ply-depth of lines included in the book.
102 =item B<-min-game> (default: 3)
104 Specifies the minimum number of games that have to contain this move for it to be included in the book.
106 =item B<-min-score> (default: 0.0)
108 Specifies the minimum score (or weight) this move should have received for
109 it to be included in the book. The score is 2*(wins)+(draws), globally scaled
114 Include only moves for white in the book.
118 Include only moves for black in the book.
122 Set all weights to 1. In other words, all moves will be selected with
130 =head2 polyglot merge-book
132 PolyGlot supports the following options
138 First input file (in PolyGlot book format).
142 Second input file (in PolyGlot book format).
144 =item B<-out> (default: out.bin)
146 Output file (in PolyGlot book format).
150 Input files are not symmetrical, "in1" has priority over "in2". In other
151 words when a position occurs both in "in1" and "in2" only the
152 moves and weights from "in1" will be retained in "out".
156 =head2 polyglot epd-test
158 (possibly with a config file as first argument) PolyGlot supports the following
163 =item B<-max-depth> (default: 63)
165 Unconditionally stop the search when this depth has
168 =item B<-max-time> (default: 5.0)
170 Unconditionally stop the seach after this amount of time.
172 =item B<-depth-delta> (default: 3)
174 Stop the search if the best move has been constant for this many depths,
175 on condition that the mininal depth and minimal time have been reached.
177 =item B<-min-depth> (default: 8)
179 Minimal search depth when the search is stopped using "-depth-delta".
181 =item B<-min-time> (default: 1.0)
183 Minimal search time when the search is stopped using "-depth-delta".
190 =head2 polyglot perft
192 PolyGlot supports the following
197 =item B<-fen> (default: starting position)
199 Fen at which to start searching.
201 =item B<-max-depth> (default: 1)
203 Maximum depth to search.
207 =head1 CONFIG FILE FORMAT
209 There should be a different config file for each engine.
211 The config file is in the traditional INI format.
220 Lines starting with "#" are ignored.
222 NOTE: There can be spaces in option names or values. Do not use
223 quotes. Boolean values are written as "true" or "false".
225 =head2 [PolyGlot] section
227 This section is used by PolyGlot only. The engine is unaware of these
228 options. The list of available options is detailed below.
232 =item B<EngineName> (default: UCI name)
234 This is the name that will appear in the GUI. It is
235 cosmetic only. You can use different names for tweaked versions of
238 =item B<EngineDir> (default: ".")
240 Full path of the directory where the engine is installed. You can use
241 "." (without the quotes) if you know that PolyGlot will be launched in
242 the engine directory or the engine is in the "path" and does not need
245 =item B<EngineCommand>
247 Put here the name of the engine executable file. You can also add
248 command-line arguments. Path searching is used and the current
249 directory will be "EngineDir".
251 =item B<Log> (default: false)
253 Whether PolyGlot should log all transactions with the interface and
254 the engine. This should be necessary only to locate problems.
256 =item B<LogFile> (default: polyglot.log)
258 The name of the log file. Note that it is put where PolyGlot was
259 launched from, not into the engine directory.
261 WARNING: Log files are not cleared between sessions, and can become
262 very large. It is safe to remove them though.
264 =item B<Resign> (default: false)
266 Set this to "true" if you want PolyGlot to resign on behalf of the
269 NOTE: Some engines display buggy scores from time to time although the
270 best move is correct. Use this option only if you know what you are
271 doing (e.g. you always check the final position of games).
273 =item B<ResignMoves> (default: 3)
275 Number of consecutive moves with "resign" score (see below) before
276 PolyGlot resigns for the engine. Positions with only one legal move
279 =item B<ResignScore> (default: 600)
281 This is the score in centipawns that will trigger resign "counting".
283 =item B<ShowPonder> (default: true)
285 Show search information during engine pondering. Turning this off
286 might be better for interactive use in some interfaces.
288 =item B<KibitzMove> (default: false)
290 Whether to kibitz when playing a move.
292 =item B<KibitzPV> (default: false)
294 Whether to kibitz when the PV is changed (new iteration or new best move).
296 =item B<KibitzCommand> (default: "tellall")
298 xboard command to use for kibitzing, normally "tellall" for kibitzing
299 or "tellothers" for whispering.
302 =item B<KibitzDelay> (default: 5)
304 How many seconds to wait before starting kibitzing. This has an
305 effect only if "KibitzPV" is selected, move kibitzes are always sent
306 regardless of the delay.
308 =item B<UCI> (default: false)
310 If true PolyGlot will not understand xboard commands.
312 =item B<Book> (default: false)
314 Indicates whether a PolyGlot book should be used. This has no effect
315 on the engine own book (which can be controlled with the UCI option
316 "OwnBook" in the [Engine] section). In particular, it is possible to
317 use both a PolyGlot book and an engine book. In that case, the engine
318 book will be used whenever PolyGlot is out of book. Remember that
319 PolyGlot is unaware of whether the engine is itself using a book or
322 =item B<Chess960> (default: false)
324 Play Chess960 (also called Fischer Random Chess or FRC),
326 =item B<MateScore> (default: 10000)
328 Mate score reported to GUI when in xboard mode.
330 =item B<BookFile> (default: book.bin)
332 The name of the (binary) book file. Note that PolyGlot will look for
333 it in the directory it was launched from, not in the engine directory.
334 Of course, full path can be used in which case the current directory
337 NOTE: When using PolyGlot with a UCI GUI this parameter can be set
338 via the UCI option "Polyglot BookFile".
340 =item B<BookRandom> (default: true)
342 Select moves according to their weights in the book. If false the move
343 with the highest weight is selected.
345 =item B<BookLearn> (default: false)
347 Record learning information in the opening book. Naturally this requires
348 the opening book to be writable.
350 =item B<UseNice> (default: false)
352 Run the engine at nice level 5, or "NiceValue" if it set. On some
353 operating systems it may be necessary to run the engine at lower
354 priority for it to be responsive to commands from PolyGlot while
357 =item B<NiceValue> (default: 5)
359 Nice levels go from -20 to 20 with 20 being the lowest priority.
360 On Unix only root can set negative nice levels. On Windows the standard
361 Win32 priority levels are mapped in a sensible way to Unix nice levels.
364 =item B<Affinity> (default: -1)
366 This a bit vector in which each bit represents the processors that a
367 process is allowed to run on. This option works only on Windows.
374 Work arounds are identical to options except that they should be used
375 only when necessary. Their purpose is to try to hide problems with
376 various software (not just engines). The default value is always
377 correct for bug-free software.
379 IMPORTANT: Any of these work arounds might be removed in future
380 versions of PolyGlot. You are strongly recommended to contact the
381 author of faulty software and truly fix the problem.
383 PolyGlot supports the following work arounds:
387 =item B<UCIVersion> (default: 2)
389 The default value of 2 corresponds to UCI+. Use 1 to select plain
390 UCI for engines that have problems with UCI+.
392 =item B<CanPonder> (default: false)
394 PolyGlot now conforms to the documented UCI behaviour: the engine will
395 be allowed to ponder only if it (the engine) declares the "Ponder" UCI
396 option. However some engines which can actually ponder do not declare
397 the option. This work around lets PolyGlot know that they can ponder.
399 =item B<SyncStop> (default: false)
401 When a ponder miss occurs, Polyglot interrupts the engine and
402 IMMEDIATELY launches a new search. While there should be no problem
403 with this, some engines seem confused and corrupt their search board.
404 "SyncStop" forces PolyGlot to wait for the (now useless) ponder search
405 to finish before launching the new search.
407 =item B<PromoteWorkAround> (default: false)
409 Some engines do not specify a promotion piece, e.g. they send "e7e8"
410 instead of the correct "e7e8q". This work around enables the
411 incorrect form (and of course promotes into a queen).
413 =item B<RepeatPV> (default: true)
415 When true, PolyGlot repeats the last pv string (which also contains
416 score,depth and time usage) it got from the engine. Some engines
417 however do not send a new pv string just before sending the move and
418 the now old pv string might confuse debugtools that parse the winboard
425 =head2 [Engine] section
427 This section contains engine UCI options. PolyGlot does not
428 understand them, but sends the information to the engine at startup
429 (converted to UCI form). You can add any UCI option that makes sense
430 to the engine (not just the common options about hash-table size and
433 NOTE: use INI syntax, not UCI. For example "OwnBook = true" is
434 correct. It will be replaced by PolyGlot with "setoption name OwnBook
435 value true" at engine startup.
437 Standard UCI options are
444 Hidden options like "Ponder" or "UCI_xxx" are automatic
445 and should not be put in an INI file.
447 The other options are engine-specific. Check their name using a UCI
448 GUI or launch the engine in a console and type "uci".
452 Compile "games.pgn" into a book "book.bin" retaining all lines of at
455 polyglot make-book -pgn games.pgn -bin book.bin -max-ply 30
457 Merge books "in1.bin" and "in2.bin" into a book "out.bin".
459 polyglot merge-book -in1 w1.bin -in2 w2.bin -out w.bin
462 Here is a minimal config file
465 EngineCommand = fruit
471 PolyGlot always returns 0 on exit.
475 Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
477 Native Windows port: Huang Chen<webmaster@elephantbase.net> ("Morning Yellow")
479 Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
481 UCI port: Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>