# Winboard as UCI engine

#### Advanced features

### Option in the property/Personality dialog box and .eng file of the engine

Summarize of features:

Program
  Name of executable file for engine.
InitString
  Initializing commands to the engine.
Hash command
  Command to set the hash-table size.
Hash
  Default hash-table size.
HashOnCommandline
  Set the hash size on command line.
InitTime
  Time from the engine is started to when its ready for play.
Edit
  Command used for edit the board.
WhiteScore
  Score is given with white as plus when engine is black.
OwnBook
  The engine have its own book.
Ponder
  The engine is able of pondering.
Analyze
  The 'analyze' command is implemented.
UseUndo
  The 'undo' command is implemented.
Logfile
  Write communication to a log file.
Priority
  Set the priority for the engine.
RunIdle
  Set the startup priority for the engine.
Protocol
  Winboard protocol version.
ShowThinkingMove
  Show extended thinking information under search/ponder.
AddHintMove
  The hint move should be added when pv is sent to the gui.
LevelExtend
  Different ways to set the time control.
Delay
  Add a delay in ms between commands to the gui.
Visible
  Set which option should be visible in the gui.
Computer
  Tell the engine if he plays against a computer
TerminateHard
  The adapter do the three finger salute for you.
Engine-spesific options
  Command for tuning the engine
Help file
  Make your own help file.
Escape characters
  Escape characters for some options

In the theory all this option should also be edit able from the GUI. This isn't always true, some GUI will not show text variables like Program, InitString and HashCommand.

#### Program

Full path to the winboard compatible engine. If the engine need a parameter to go into xboard mode add this too here.

ex. Bringer.exe /winboard
Default=none

#### InitString

If you need any additional command to set up the engine you could add it here. The string could content escape characters (\n, \f \x1a etc.).

Default=none

#### HashCommand

Command to give for setting the hash. The hash value is given as mega byte. For the hash value to not be added to the end of this string you can use %i to define where in the string the value should be added. The string could content escape characters (\n, \f \x1a etc.).

Default=none

Ex.
HashCommand=set hash
HashCommand=hash %iM
HashCommand=hashvalue %i
HashCommand=cm_parm tts=%i000000

#### Hash

Default hash size in MB.

Default=2

#### HashOnCommandline

If true the hashcommand given above should be put on the command line instead as a command after the startup.

Default=false

#### InitTime

The time the engine need to initialize before it could move. Without endgame tables this could be 2 sec. With endgame tables you must probably add up to 30 sec. depending on the speed of your PC.

If the engine use the protocol version two method with feature done=0/1 the InitTime value is ignored. There will be a panic timeout on 60 sec. instead.

Default=2

#### Edit

Select the method the engine need to setup a position.

setbord - The new winboard method that use a fen-string.
edit - The old winboard method.
cb-edit - Chessbase's extending of edit, includes possibility to set castle and enpassant.

This is only in use when the start position of the game wasn't the standard start position. A protocol ver. II engine could overwrite this.

Default=setboard

#### WhiteScore

The engine always have white as plus-score

Default=false

#### OwnBook

The engine take care of the book.

Default=false

#### Ponder

Let the engine ponder when the opponent have the move. Normal the GUI adjust this in other places than the setup-box. (Permanent brain, Think on opponents time etc.) Set this to false if the engine don't support ponder.

Default=true

#### Analyze

If this is true the adapter would use the analyze command for infinity analysis. If the engine don't support this set it to false which will result in that the adapter set the engine to use a long time control instead.

Valid options:
Analyze=false|true
Default=true

#### UseUndo

If the engine don't have the command 'undo' this option could be set to false.

Valid options:
UseUndo=false|true
Default=true

#### Logfile

Write a log file in the same directory as Wb2Uci.exe lives. Name of log file is Wb2Uci.log When you enable 'Logfile' all new log's are appended to the file so the file could be really big after some games. For easier work with the file you could delete it when you finish working with it.

Default=false

Format of log-file

<time in sec.msec> <Server or client end><send or receive> <text>

Ex.
4.487: S> move e2e4
4.497: C< bestmove e2e4
6.850: C> position startpos moves e2e4 e7e5
6.850: C> go wtime 56415
6.850: S< time 5641
6.850: S< e7e5

Line 1: The engine (server) has sent a move
Line 2: The move is sent to the GUI (client)
Line 3: A position/move receives from the GUI
Line 4: The GUI ask the engine to start the search
Line 5: The time is sent to the engine
Line 6: The move is sent to the engine.

#### Priority

Use this if you need to tune the priority the engine need. For analysis it's often useful to set this to low.

If the GUI adjust this himself the adapter will pass on this priority changes to the engine.

Valid options:
Priority=Normal|BelowNormal|Low
Default=Normal

#### RunIdle

If this option is true the engine is started up in idle mode. The priority option would not have any effect. This option is to force engines with threads to be running with lower priority when the GUI isn't able to reach the search thread.

Engine-Engine matches with ponder on would not give correct result when the engine is running in this mode.

This option is for engines that want show normal pv output in Fritz, all pv- lines are comming together after the engine has moved.

You should first check if the engine has an option on his own to alter the priority before you use this.

Default=false

#### Protocol

If the engine is using protocol 1 you can take away the question sent to the engine with setting 1 here. There are only few engines that need this, eg. crashes with unknown command.

If the engine is protocol version 2 some of the other setting are overwritten with the settings the engine send.

Default=2

#### ShowThinkingMove

Let the engine show the move it's thinking of under search. Note that not all engines support this. This option would stress the engine a bit maybe 1-2% longer searchtime but converted to elo it would be less than 1 point.

Valid options:
ShowThinkingMove=false|true
Default=false

#### AddHintMove

Some GUI need the PV to include the move that the engine ponder on. This switch is for adding the pondermove in front of the PV when the engine is ponder.

Default=false

#### LevelExtend

If the engine treat the level command in the middle of a game as a start point for a new counting of moves set this to Progressive.

If the engine apply the time control to the hole game use Strict. You would see this if you use a time control like 1/20 + 1/15 + 1/game. If the engine is in heavy time pressure from move 31 to 35 or loos on time between this moves you need probably to set this to strict.

If the engine don't accept any level command in the middle of a game set this to Failsafe.

Valid options:
LevelExtend=Progressive|Strict|Failsafe
Default=Progressive

#### Visible

This isn't really an option but a way to control which option that should be sent to the gui and displayed there. Separate each option with a ','. This option could be added either to [ENGINE] or [OPTIONS] section. For Engine specific command to be used you must add Extras to this string.

Ex. A normal engine could have the following set.
Visible=Hash,Ponder,OwnBook,ShowThinkingMove,Logfile,Extras

Default=<option visible>

#### Computer

Tells the engine that he plays against a computer. Some engines may alter some drawscore etc. when this is set.

Default=off

#### TerminateHard

For os's that do a cleanup when you terminate a program, you can let the adapter terminate the engine if stopping fails instead of leaving it running.

Default=false

### Engine-spesific options

Start a section in the .eng file with the line [EXTRAS]

Each key in this file should be on one of these format:
Gui-command|Engine-command|spin|Default value|Minimum-value|Maximum-value
Gui-command|Engine-command|check|default(true or false)|false value|true value
Gui-command|Engine-command|button
Gui-command|Engine-command|combo|Default value|var 1|var 2|...|var n
Gui-command|Engine-command|string|Default value

There are three standard commands that could be used here if your engine support them:
Clear Hash=reset|button
NalimovPath=TBpath|string|=.\TB\
NalimovCache=TBsize %iM|spin|2|1|32

Gui-command
  Text for this option in the properties-box for the gui.
Engine-Command
  Command to send the engine. If the value should not be appended to the command you can use the %i or %s to set this on the right place. %i is for integer values in 'spin' types and %s is for string values in 'check', 'combo' or 'string' types.
  The string could content escape characters (\n, \f \x1a etc.). There is a special 'Engine-command' that instruct the adapter to read commands form a file. The command is '<readfile>' and must be a combo or string type. This is made so have a possibility to make ready to use personalities in files and could select the right file from the combobox.
  Ex.
  Select style=<readfile>|combo|CMDefault|CMDefault|CM8777|CMFun|Josh 8 year|etc..
  and then make files with the name CMDefault.txt, CM8777.txt etc. where you have added the right settings.
  Notice that the filename have to be selectionvalue+.txt
Type
  For 'spin' options you can use '%i' if where you would add the value. Likewise for 'check', 'combo' and 'string' options you can use %s. If neither %i or %s is in the engine command this would be added after the string like : 'command' + ' %i'
  ex.
  [EXTRAS]
  Passed Pawn=set passedpawn %i|spin|45|-100|100
  Clear Hash=clearmem|button
  Nullmove=set nullmove %s|check|true|0|1
  Style=style %s|combo|normal|solid|normal|aggresive
  Book=bookfile %s|string|PolarChess.book
Default value (spin,check,string,combo)
  Default value for this option. This is not the value you want to be default but the default value when the engine start. For check option use true or false for default option. No escape character allowed here!.
Minimum value (spin,check)
  Minimum value for spin option. False value for check option.
Maximum value (spin,check)
  Maximum value for spin option. True value for check option.
Var n (combo)
  Variable list for combo box.

### Help file

Some gui are able to show a help button. For this to show a help text you must make a help file in html format and have it in the same folder as the adapter. The name of the help file must be Wb2Uci.html. If you use Visible filter add 'Help' to the line for it to show up in the GUI.

### Escape characters

In InitString, HashCommand and as an engine-command in [EXTRAS] options it is allowed to use escape characters for none printable characters.

The standard characters are:

    \n  New line           \\    Backslash
    \t  Horizontal tab     \?    Question mark
    \v  Vertical tab       \'    Single quote
    \b  Backspace          \"    Double quote
    \r  Carriage return    \ooo  Octal number (any character)
    \f  Formfeed           \xhh  Hex number (any character)
    \a  Bell

Odd Gunnar Malin, malin@online.no