version 1.4.53b
[polyglot.git] / polyglot.man
index 79a28a0..12f1611 100644 (file)
 .\" ========================================================================
 .\"
 .IX Title "POLYGLOT 6"
-.TH POLYGLOT 6 "2009-01-10" "" ""
+.TH POLYGLOT 6 "2009-09-11" "" ""
 .SH "NAME"
 PolyGlot \-  Winboard protocol to UCI protocol adapter
          \-  book engine for Polyglot books 
-         \-  a collection of utilities for creating opening books
+         \-  a collection of utilities for creating and analyzing opening books
          \-  a utility for analyzing epd files
          \-  a perft counter
 .SH "SYNOPSIS"
 .IX Header "SYNOPSIS"
-polyglot [configfile]
+polyglot [configfile] [\-noini] [\-ec engine] [\-ed enginedirectory] [\-en enginename] [\-log] [\-lf logfile] [\-hash value] [\-bk book] [\-pg <name>=<value>]* [\-uci <name>=<value>]*
 .PP
 polyglot make-book [\-pgn inputfile] [\-bin outputfile] [\-max\-ply ply] [\-min\-game games] [\-min\-score score] [\-only\-white] [\-only\-black] [\-uniform]
 .PP
 polyglot merge-book \-in1 inputfile1 \-in2 inputfile2 [\-out outputfile]
 .PP
-polyglot [configfile] epd-test [\-epd inputfile] [\-min\-depth depth] [\-max\-depth depth] [\-max\-time time] [\-depth\-delta delta] 
+polyglot info-book [\-bin inputfile] [\-exact]
+.PP
+polyglot dump-book [\-bin inputfile] \-color color [\-out outputfile]
+.PP
+polyglot [configfile] epd-test [engineoptions] [\-epd inputfile] [\-min\-depth depth] [\-max\-depth depth] [\-max\-time time] [\-depth\-delta delta] 
 .PP
 polyglot perft [\-fen fen] [\-max\-depth depth]
 .SH "DESCRIPTION"
@@ -169,6 +173,17 @@ repetition, etc ... It also supports Chess960.
 When in \s-1UCI\s0 mode PolyGlot mostly passes commands from the \s-1GUI\s0
 to the engine and vice versa, except that it will play book moves on
 behalf of the engine when the occasion arises.
+.PP
+The engine options are exported as \s-1UCI\s0 options in \s-1UCI\s0
+mode and as \*(L"feature option=\*(R" commands in xboard mode. The latter form
+an extension of the xboard protocol as defined by H.G. Muller.
+.PP
+Options which normally appear in the [PolyGlot] section of the
+config file (see below) are exported as options with their name prefixed
+by \*(L"Polyglot\*(R". This makes it easy to filter them in the \s-1GUI\s0.
+.PP
+\&\s-1NOTE:\s0 Not all options are exported, only those that make sense in the
+given mode.
 .Sh "Book making utilities"
 .IX Subsection "Book making utilities"
 PolyGlot supports the \*(L"PolyGlot opening book format\*(R". This is the
@@ -187,7 +202,33 @@ Other opening book formats such as ChessBase's .ctg format and Arena's
 by their own GUIs. 
 .PP
 PolyGlot can compile a pgn file into a binary PolyGlot book and furthermore
-it can merge two such binary books into a third one. 
+it can merge two such binary books into a third one.
+.PP
+PolyGlot can also extract some useful information from PolyGlot books. The utility
+\&\*(L"dump\-book\*(R" dumps the \*(L"lines\*(R" in a book for a given color. By definition
+a line is a sequence of moves (from the starting position) in which
+the given color makes only book moves and the other color makes 
+arbitrary moves (i.e. not necessarily book moves).
+.PP
+Since a PolyGlot book is built up from positions and not lines there
+may be (and there usually are) many positions in the book that are not
+on a \*(L"line\*(R" as defined in the previous paragraph. It is convenient
+to call such positions \*(L"isolated\*(R" positions. The utility \*(L"info\-book\*(R"
+counts such isolated positions.
+.PP
+Some of the isolated positions are provably unreachable and they
+could in principle be deleted from the book. For example if a book
+contains only the move \*(L"e4\*(R" in the starting position but also the
+position after \*(L"d4 d5\*(R" then this last position is provably unreachable
+since it requires white to make a non-book move when a book move is
+available. Such situations arise frequently from the priority rules
+in merging books.
+.PP
+Unfortunately not all isolated positions are provably unreachable and
+it is difficult to identify the latter. If invoked with \*(L"\-exact\*(R" the
+utility info-book will attempt to count the isolated positions which
+require a player to make a non-book move when a book move is available.
+Due to the possibility of transpositions this is not a fool proof method.
 .Sh "Epd test mode"
 .IX Subsection "Epd test mode"
 In epd test mode, PolyGlot will search positions in an epd file and
@@ -200,9 +241,44 @@ up to a given depth. PolyGlot can perform such perft counts. It
 is however much slower than other more dedicated programs.
 .SH "OPTIONS"
 .IX Header "OPTIONS"
-When invoked without options or with a config file as argument PolyGlot
-acts as an adapter. The config file format is documented below.  The
-default config file is \*(L"polyglot.ini\*(R".
+When PolyGlot is invoked as an adapter of in epd-test mode it gets its
+options from a config file and then from the command line.  The
+default config file is \*(L"polyglot.ini\*(R" but an alternative one may be
+optionally included as first argument. The config file format is
+described below.
+.PP
+The following engine options may be specified on the command line.
+.IP "\fB\-noini\fR" 4
+.IX Item "-noini"
+Do not use a config file, even if one was specified on the command line.
+.IP "\fB\-pg\fR" 4
+.IX Item "-pg"
+The argument is a string of the form <name>=<value>. This option will
+set the Polyglot option <name> to <value>. 
+.IP "\fB\-uci\fR" 4
+.IX Item "-uci"
+The argument is a string of the form <name>=<value>. This option will
+set the engine option <name> to <value>. 
+.IP "\fB\-ec\fR" 4
+.IX Item "-ec"
+This is an alias for \-pg \*(L"EngineCommand=<value>\*(R"
+.IP "\fB\-ed\fR" 4
+.IX Item "-ed"
+This is an alias for \-pg \*(L"EngineDir=<value>\*(R"
+.IP "\fB\-en\fR" 4
+.IX Item "-en"
+This is an alias for \-pg \*(L"EngineName=<value>\*(R"
+.IP "\fB\-log\fR (default: false)" 4
+.IX Item "-log (default: false)"
+This is an alias for \-pg \*(L"Log=<value>\*(R"
+.ie n .IP "\fB\-lf\fR (default: ""polyglot.log"")" 4
+.el .IP "\fB\-lf\fR (default: ``polyglot.log'')" 4
+.IX Item "-lf (default: polyglot.log)"
+This is an alias for \-pg \*(L"LogFile=<value>\*(R".
+.ie n .IP "\fB\-wb\fR (default: ""true"")" 4
+.el .IP "\fB\-wb\fR (default: ``true'')" 4
+.IX Item "-wb (default: true)"
+This is an alias for \-pg \*(L"OnlyWbOptions=<value>\*(R".
 .PP
 When invoked as
 .Sh "polyglot make-book"
@@ -257,11 +333,40 @@ Input files are not symmetrical, \*(L"in1\*(R" has priority over \*(L"in2\*(R".
 words when a position occurs both in \*(L"in1\*(R" and \*(L"in2\*(R" only the
 moves and weights from \*(L"in1\*(R" will be retained in \*(L"out\*(R".
 .PP
+When invoked
+as
+.Sh "polyglot dump-book"
+.IX Subsection "polyglot dump-book"
+PolyGlot supports the following options
+.IP "\fB\-bin\fR (default: book.bin)" 4
+.IX Item "-bin (default: book.bin)"
+Input file in PolyGlot book format.
+.IP "\fB\-color\fR" 4
+.IX Item "-color"
+The color for whom to generate the lines.
+.IP "\fB\-out\fR (default: book_<color>.txt)" 4
+.IX Item "-out (default: book_<color>.txt)"
+The name of the output file.
+.PP
+When invoked
+as
+.Sh "polyglot info-book"
+.IX Subsection "polyglot info-book"
+PolyGlot supports the following options
+.IP "\fB\-bin\fR (default: book.bin)" 4
+.IX Item "-bin (default: book.bin)"
+Input file in PolyGlot book format.
+.IP "\fB\-exact\fR" 4
+.IX Item "-exact"
+Attempt to count the provably unreachable positions among the isolated ones.
+Note that this takes a very long time. 
+.PP
 When invoked as
 .Sh "polyglot epd-test"
 .IX Subsection "polyglot epd-test"
-(possibly with a config file as first argument) PolyGlot supports the following
-options
+(possibly with a config file as first argument) PolyGlot supports
+besides the generic options described above the following additional
+options.
 .IP "\fB\-max\-depth\fR (default: 63)" 4
 .IX Item "-max-depth (default: 63)"
 Unconditionally stop the search when this depth has
@@ -271,8 +376,9 @@ been reached.
 Unconditionally stop the seach after this amount of time.
 .IP "\fB\-depth\-delta\fR (default: 3)" 4
 .IX Item "-depth-delta (default: 3)"
-Stop the search if the best move has been constant for this many depths,
-on condition that the mininal depth and minimal time have been reached.
+Stop the search if the solution as been found and the best move has
+been constant for this many depths, on condition that the mininal
+depth and minimal time have been reached.
 .IP "\fB\-min\-depth\fR (default: 8)" 4
 .IX Item "-min-depth (default: 8)"
 Minimal search depth when the search is stopped using \*(L"\-depth\-delta\*(R".
@@ -306,10 +412,12 @@ The config file is in the traditional \s-1INI\s0 format.
 \&    ...
 .Ve
 .PP
-Lines starting with \*(L"#\*(R" are ignored.
+The characters \*(L"#\*(R" and \*(L";\*(R" serve as comment characters. 
 .PP
-\&\s-1NOTE:\s0 There can be spaces in option names or values.  Do not use
-quotes. Boolean values are written as \*(L"true\*(R" or \*(L"false\*(R". 
+By default initial and final white space is stripped from option
+values. If you want to avoid this, or if you want use one of
+the comment characters # or ; in option values (such as for NalimovPath), 
+enclose the value in quotes.
 .Sh "[PolyGlot] section"
 .IX Subsection "[PolyGlot] section"
 This section is used by PolyGlot only.  The engine is unaware of these
@@ -331,6 +439,15 @@ any data file.
 Put here the name of the engine executable file.  You can also add
 command-line arguments.  Path searching is used and the current
 directory will be \*(L"EngineDir\*(R".
+.ie n .IP "\fBSettingsDir\fR (default: $HOME/.polyglot on Linux; "".\e_PG"" on Windows)" 4
+.el .IP "\fBSettingsDir\fR (default: \f(CW$HOME\fR/.polyglot on Linux; ``.\e_PG'' on Windows)" 4
+.IX Item "SettingsDir (default: $HOME/.polyglot on Linux; ._PG on Windows)"
+The directory where ini files are stored for engines that are started with
+\&\-noini. Such ini files may be created by pushing the \*(L"Save\*(R" button in the
+Engine settings dialog in \s-1WB/XB\s0 4.4.0 and higher. As a special exception
+(for \s-1WB/XB\s0 4.4.0 compatibility) this directory is also used in case
+PolyGlot is started with config files named \*(L"polyglot_1st.ini\*(R" or
+\&\*(L"polyglot_2nd.ini\*(R".
 .IP "\fBLog\fR (default: false)" 4
 .IX Item "Log (default: false)"
 Whether PolyGlot should log all transactions with the interface and
@@ -362,6 +479,9 @@ This is the score in centipawns that will trigger resign \*(L"counting\*(R".
 .IX Item "ShowPonder (default: true)"
 Show search information during engine pondering.  Turning this off
 might be better for interactive use in some interfaces.
+.IP "\fBScoreWhite\fR (default: true)" 4
+.IX Item "ScoreWhite (default: true)"
+Report score from white's point of view in xboard mode.
 .IP "\fBKibitzMove\fR (default: false)" 4
 .IX Item "KibitzMove (default: false)"
 Whether to kibitz when playing a move.
@@ -378,9 +498,16 @@ or \*(L"tellothers\*(R" for whispering.
 How many seconds to wait before starting kibitzing.  This has an
 effect only if \*(L"KibitzPV\*(R" is selected, move kibitzes are always sent
 regardless of the delay.
+.IP "\fBKibitzInterval\fR (default: 0)" 4
+.IX Item "KibitzInterval (default: 0)"
+This is another form of throttling. PolyGlot will usually wait this
+many seconds before doing the next kibitz. 
 .IP "\fB\s-1UCI\s0\fR (default: false)" 4
 .IX Item "UCI (default: false)"
 If true PolyGlot will not understand xboard commands. 
+.IP "\fBMateScore\fR (default: 10000)" 4
+.IX Item "MateScore (default: 10000)"
+Mate score reported to \s-1GUI\s0 when in xboard mode.
 .IP "\fBBook\fR (default: false)" 4
 .IX Item "Book (default: false)"
 Indicates whether a PolyGlot book should be used.  This has no effect
@@ -390,29 +517,26 @@ use both a PolyGlot book and an engine book.  In that case, the engine
 book will be used whenever PolyGlot is out of book.  Remember that
 PolyGlot is unaware of whether the engine is itself using a book or
 not.
-.IP "\fBChess960\fR (default: false)" 4
-.IX Item "Chess960 (default: false)"
-Play Chess960 (also called Fischer Random Chess or \s-1FRC\s0),
-.IP "\fBMateScore\fR (default: 10000)" 4
-.IX Item "MateScore (default: 10000)"
-Mate score reported to \s-1GUI\s0 when in xboard mode. 
 .IP "\fBBookFile\fR (default: book.bin)" 4
 .IX Item "BookFile (default: book.bin)"
 The name of the (binary) book file.  Note that PolyGlot will look for
 it in the directory it was launched from, not in the engine directory.
 Of course, full path can be used in which case the current directory
 does not matter.
-.Sp
-\&\s-1NOTE:\s0 When using PolyGlot with a \s-1UCI\s0 \s-1GUI\s0 this parameter can be set
-via the \s-1UCI\s0 option \*(L"Polyglot BookFile\*(R". 
 .IP "\fBBookRandom\fR (default: true)" 4
 .IX Item "BookRandom (default: true)"
 Select moves according to their weights in the book. If false the move
 with the highest weight is selected. 
 .IP "\fBBookLearn\fR (default: false)" 4
 .IX Item "BookLearn (default: false)"
-Record learning information in the opening book. Naturally this requires
-the opening book to be writable. 
+Store learning information in the book (which must be writable). Currently
+no engine actually uses this information. 
+.IP "\fBBookDepth\fR (default: 256)" 4
+.IX Item "BookDepth (default: 256)"
+Stop using the book after this number of moves. 
+.IP "\fBBookTreshold\fR (default: 5)" 4
+.IX Item "BookTreshold (default: 5)"
+Do not play moves with a weight (probability) lower than this (in per mil). 
 .IP "\fBUseNice\fR (default: false)" 4
 .IX Item "UseNice (default: false)"
 Run the engine at nice level 5, or \*(L"NiceValue\*(R" if it set.  On some
@@ -428,12 +552,15 @@ Win32 priority levels are mapped in a sensible way to Unix nice levels.
 .IX Item "Affinity (default: -1)"
 This a bit vector in which each bit represents the processors that a
 process is allowed to run on. This option works only on Windows. 
+.IP "\fBOnlyWbOptions\fR (default: true)" 4
+.IX Item "OnlyWbOptions (default: true)"
+If true then PolyGlot restricts the options it sends to those that
+are potentially useful for WinBoard. 
 .Sh "Work arounds"
 .IX Subsection "Work arounds"
 Work arounds are identical to options except that they should be used
 only when necessary.  Their purpose is to try to hide problems with
-various software (not just engines).  The default value is always
-correct for bug-free software.
+various software (not just engines).  
 .PP
 \&\s-1IMPORTANT:\s0 Any of these work arounds might be removed in future
 versions of PolyGlot.  You are strongly recommended to contact the
@@ -466,9 +593,10 @@ incorrect form (and of course promotes into a queen).
 .IX Item "RepeatPV (default: true)"
 When true, PolyGlot repeats the last pv string (which also contains
 score,depth and time usage) it got from the engine. Some engines
-however do not send a new pv string just before sending the move and
-the now old pv string might confuse debugtools that parse the winboard
-debug files.
+however do not send a new pv string just before sending the move.
+In that case the output of PolyGlot would be inconsistent. 
+When RepeatPV is false PolyGlot does not repeat the last pv string.
+Due to the way kibitzing is implemented, KibitzMove is disabled in that case. 
 .Sh "[Engine] section"
 .IX Subsection "[Engine] section"
 This section contains engine \s-1UCI\s0 options.  PolyGlot does not
@@ -497,6 +625,28 @@ The other options are engine\-specific.  Check their name using a \s-1UCI\s0
 \&\s-1GUI\s0 or launch the engine in a console and type \*(L"uci\*(R".
 .SH "EXAMPLES"
 .IX Header "EXAMPLES"
+Running the \s-1UCI\s0 engine \*(L"fruit\*(R" under xboard 4.3.15 and later (this invokes PolyGlot internally).
+.PP
+.Vb 1
+\&    xboard \-fcp fruit \-fUCI
+.Ve
+.PP
+An explicit command line for using the \s-1UCI\s0 engine \*(L"fruit\*(R" with 128M hash in xboard with logging enabled (this also works on xboard 4.2.7).
+.PP
+.Vb 1
+\&    xboard \-fcp "polyglot \-noini \-log \-ec fruit \-hash 128"
+.Ve
+.PP
+The equivalent config file would be:
+.PP
+.Vb 5
+\&    [PolyGlot]
+\&    EngineCommand = fruit
+\&    Log = true
+\&    [Engine]
+\&    Hash=128
+.Ve
+.PP
 Compile \*(L"games.pgn\*(R" into a book \*(L"book.bin\*(R" retaining all lines of at
 most 30 plies.
 .PP
@@ -504,18 +654,22 @@ most 30 plies.
 \&    polyglot make\-book \-pgn games.pgn \-bin book.bin \-max\-ply 30
 .Ve
 .PP
-Merge books \*(L"in1.bin\*(R" and \*(L"in2.bin\*(R" into a book \*(L"out.bin\*(R".
+Merge books \*(L"w1.bin\*(R" and \*(L"w2.bin\*(R" into a book \*(L"w.bin\*(R".
 .PP
 .Vb 1
 \&    polyglot merge\-book \-in1 w1.bin \-in2 w2.bin \-out w.bin
 .Ve
 .PP
-Here is a minimal config file
+Inspect lines for white in \*(L"w.bin\*(R"
 .PP
-.Vb 3
-\&    [PolyGlot]
-\&    EngineCommand = fruit
-\&    [Engine]
+.Vb 1
+\&    polyglot dump\-book \-bin w.bin \-color white \-out w_white.txt
+.Ve
+.PP
+Test epd file \*(L"test.epd\*(R" with a (maximum) search time of 7 minutes per position
+.PP
+.Vb 1
+\&    polyglot epd\-test \-epd test.epd \-max\-time 420
 .Ve
 .SH "EXIT STATUS"
 .IX Header "EXIT STATUS"
@@ -528,7 +682,8 @@ Native Windows port:  Huang Chen<webmaster@elephantbase.net> (\*(L"Morning Yello
 .PP
 Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
 .PP
-\&\s-1UCI\s0 port: Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>
+\&\s-1UCI\s0 port and implementation of new \s-1WB\s0 protocol: Michel Van den Bergh
+<michel.vandenbergh(at)uhasselt.be>
 .SH "SEE ALSO"
 .IX Header "SEE ALSO"
 \&\fIxboard\fR\|(6)