X-Git-Url: http://hgm.nubati.net/cgi-bin/gitweb.cgi?p=xboard.git;a=blobdiff_plain;f=engine-intf.html;h=bc4815f5fbb466b8b7a7f1b7e98e0ef8294ebd17;hp=bd6bcd798054c0001e7ce458f24310f5eda1faa5;hb=39298ae34f47966df637ad5044250a7a2a15e46a;hpb=667704141b1dccd4e38b1808f91488e0d35c03a7 diff --git a/engine-intf.html b/engine-intf.html index bd6bcd79..bc4815f5 100644 --- a/engine-intf.html +++ b/engine-intf.html @@ -1,36 +1,57 @@ - + + Chess Engine Communication Protocol + + + -
+

Chess Engine Communication Protocol

Tim Mann & H.G.Muller

-Version 2; implemented in xboard/WinBoard 4.2.1 and later.
-Changes since version 1 are indicated in red.
-Changes for WinBoard 4.3.xx are indicated in green.
-Changes for WinBoard 4.4.xx are indicated in blue. -


+Version 2; implemented in xboard/WinBoard 4.2.1 and later. (Sept 3, 2009)
+Changes since version 1 are indicated in red.
+Changes for WinBoard 4.3.xx are indicated in green.
+Changes for WinBoard 4.4.xx are indicated in blue. +

+
-
+

1. Introduction

@@ -45,11 +66,12 @@ and WinBoard except where they are specifically contrasted.

There are two reasons I can imagine someone wanting to do this:

+
  1. You have, or are developing, a chess engine but you don't want to -write your own graphical interface. +write your own graphical interface.
  2. You have, or are developing,a chess engine, and you want to -interface it to the Internet Chess Server. +interface it to the Internet Chess Server.

@@ -58,7 +80,6 @@ In case (2), if you are using xboard, you will need to configure the the file zippy.README in the xboard or WinBoard distribution for more information. -

@@ -76,14 +97,13 @@ can join at http://groups.yahoo.com/group/chess-engines, or you can read the list there without joining. The list is filtered to prevent spam.

-

- + +

Note that the WinBoard 4.3.xx line was developed independently of the original GNU project, by H.G.Muller. If you have questions about WinBoard 4.3.xx, or want to report bugs in it, report them in the appropriate section of the WinBoard forum. -

2. Connection

@@ -159,17 +179,16 @@ does not support, and I've specified the standard semantics of a few features to be slightly different from what GNU Chess 4 does.

-

- +

This release of the protocol specification is the first to carry a version number of its own -- version 2. Previous releases simply carried a last-modified date and were loosely tied to specific releases of xboard and WinBoard. The version number "1" applies generally to all those older versions of the protocol. - +

- -

Protocol version 2 remains compatible with older engines but has +

+Protocol version 2 remains compatible with older engines but has several new capabilities. In particular, it adds the "feature" command, a new mechanism for making backward-compatible changes and extensions to the protocol. Engines that do not support a @@ -183,8 +202,7 @@ including the "ping" command (recommended for all engines), the will probably be added in future versions.

-

- +

If it is necessary to have a separate name, it would be best to refer to the protocol including the green additions as version 2f. I really don't think it is a different protocol from version 2, though. @@ -194,14 +212,12 @@ The hand-shaking protocol for features as defined in protocol 2 perfectly allows addition of an occasional new features without any need for stepping up the protocol version number, and I think refraining from the latter would enormously lower the barrier for actual implementation of these features in engines. -
+
The two really new things are the engine debug comments, and the "nps" command. The former merely tries to regulate an extremely common existing pactice of having engines dump debug messages on WinBoard in an unprotected way, as usually you get away with that. -
- -
+

5. WinBoard requires Win32 engines

@@ -354,11 +370,11 @@ engines that run under xboard and (the unusual case of) engines that WinBoard remotely runs on a Unix host using the -firstHost or -secondHost feature. It does not apply to engines that run on Windows, because Windows does not have Unix-style signals. - + Beginning with version 2, you can now turn off the use of either or both signals. See the "feature" command in section 9 below. - +

First, when an engine is sent the "quit" command, it is also given @@ -429,27 +445,27 @@ games. At the end of a game, xboard will send the "force" command (see below) to make sure your engine stops thinking about the current position. It will later send the initString again to start a new game. If your engine can't play multiple games, you can disable reuse - + either with the "feature" command (beginning in protocol version 2; see below) or - + with xboard's -xreuse (or -xreuse2) command line option. xboard will then ask the process to quit after each game and start a new process for the next game.

-
xboard +
xboard
This command will be sent once immediately after your engine process is started. You can use it to put your engine into "xboard mode" if that is needed. If your engine prints a prompt to ask for user input, you must turn off the prompt and output a newline when the "xboard" command comes in. -

+

-
protover N -
-Beginning in protocol version 2 (in which N=2), this command will +
protover N
+
+

Beginning in protocol version 2 (in which N=2), this command will be sent immediately after the "xboard" command. If you receive some other command immediately after "xboard" (such as "new"), you can assume that protocol version 1 is in use. The "protover" command is @@ -457,28 +473,28 @@ the only new command that xboard always sends in version 2. All other new commands to the engine are sent only if the engine first enables them with the "feature" command. Protocol versions will always be simple integers so that they can easily be compared. +

Your engine should reply to the protover command by sending the "feature" command (see below) with the list of non-default feature -settings that you require, if any. +settings that you require, if any.

Your engine should never refuse to run due to receiving a higher protocol version number than it is expecting! New protocol versions will always be compatible with older ones by default; the larger version number is simply a hint that additional "feature" command options added in later protocol versions may be accepted. - -

+

+
-
accepted -
rejected -
+
accepted
+
rejected
+
These commands may be sent to your engine in reply to the "feature" command; see its documentation below. - -

+

-
new +
new
Reset the board to the standard chess starting position. Set White on move. Leave force mode and set the engine to play Black. Associate the engine's clock with Black and the opponent's clock with @@ -486,94 +502,83 @@ White. Reset clocks and time controls to the start of a new game. Use wall clock for time measurement. Stop clocks. Do not ponder on this move, even if pondering is on. Remove any search depth limit previously set by the sd command. -

+

-
variant VARNAME +
variant VARNAME
If the game is not standard chess, but a variant, this command is sent after "new" and before the first move or "edit" command. Currently defined variant names are: - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
wildcastleShuffle chess where king can castle from d file -
nocastleShuffle chess with no castling at all -
fischerandomFischer Random -
bughouseBughouse, ICC/FICS rules -
crazyhouseCrazyhouse, ICC/FICS rules -
losersWin by losing all pieces or getting mated (ICC) -
suicideWin by losing all pieces including king, -or by having fewer pieces when one player has no legal moves (FICS) -
giveaway -Win by losing all pieces including king, -or by having no legal moves (ICC) -
twokingsWeird ICC wild 9 -
kriegspielKriegspiel (engines not supported) -
atomicAtomic -
3checkWin by giving check 3 times -
xiangqi -Chinese Chess (9x10 board) -
shogi -Japanese Chess (9x9 bord) -
capablanca -Capablanca Chess (10x8 board, with Archbishop and Chancellor) -
gothic -Gothic Chess (10x8 board, same with better opening setup) -
falcon -Falcon Chess (10x8 board, with two Falcon pieces) -
shatranj -ancient Arabic Chess, with Elephants and General in stead of B and Q -
courier -Courier Chess (12x8 board, a medieval precursor of modern Chess -
knightmate -King moves as Knight and vice versa -
berolina -Pawns capture straight ahead, and move diagonally -
janus -Janus Chess (10x8, with two Archbishops) -
caparandom -shuffle variant like FRC (10x8 board) -
cylinder -Pieces wrap around between side edges, like board is a cylinder -
super -Superchess: a shuffle variant with 4 fairy pieces on 8x8 board -
great -Great Shatranj: sliders are replaced by corresponding short-range pieces on a 10x8 board -
unknownUnknown variant (not supported) +
wildcastleShuffle chess where king can castle from d file
nocastleShuffle chess with no castling at all
fischerandomFischer Random
bughouseBughouse, ICC/FICS rules
crazyhouseCrazyhouse, ICC/FICS rules
losersWin by losing all pieces or getting mated (ICC)
suicideWin by losing all pieces including king, + or by having fewer pieces when one player has no legal moves (FICS)
giveawayWin by losing all pieces including king, + or by having no legal moves (ICC)
twokingsWeird ICC wild 9
kriegspielKriegspiel (engines not supported)
atomicAtomic
3checkWin by giving check 3 times
xiangqi Chinese Chess (9x10 board)
shogi Japanese Chess (9x9 bord)
capablancaCapablanca Chess (10x8 board, with Archbishop and Chancellor)
gothic Gothic Chess (10x8 board, same with better opening setup)
falcon Falcon Chess (10x8 board, with two Falcon pieces)
shatranj ancient Arabic Chess, with Elephants and General in stead of B and Q
courier Courier Chess (12x8 board, a medieval precursor of modern Chess
knightmate King moves as Knight and vice versa
berolina Pawns capture straight ahead, and move diagonally
janus Janus Chess (10x8, with two Archbishops)
caparandom shuffle variant like FRC (10x8 board)
cylinder Pieces wrap around between side edges, like board is a cylinder
super Superchess: a shuffle variant with 4 fairy pieces on 8x8 board
great Great Shatranj: sliders are replaced by corresponding short-range pieces on a 10x8 board
lion Mighty-Lion Chess, with a super-knight, more powerful than a Queen
elven Elven Chess: hybrid between Chess and Chu Shogi on 10x10 board
chu Chu Shogi: Edo-period Japanese Chess on a 12x12 board
unknownUnknown variant (not supported)
-

-

quit +As of XBoard 4.8, engines can define arbitrary variant names; see the "feature" and "setup" commands in section 9. + + +
quit
The chess engine should immediately exit. This command is used when xboard is itself exiting, and also between games if the -xreuse command line option is given (or -xreuse2 for the second engine). See also Signals above. -

+

-
random +
random
This command is specific to GNU Chess 4. You can either ignore it completely (that is, treat it as a no-op) or implement it as GNU Chess does. The command toggles "random" mode (that is, it sets random = !random). In random mode, the engine adds a small random value to its evaluation function to vary its play. The "new" command sets random mode off. -

+

-
force +
force
Set the engine to play neither color ("force mode"). Stop clocks. The engine should check that moves received in force mode are legal and made in the proper turn, but should not think, ponder, or make moves of its own. -

+

-
go +
go
Leave force mode and set the engine to play the color that is on move. Associate the engine's clock with the color that is on move, the opponent's clock with the color that is not on move. Start the engine's clock. Start thinking and eventually make a move. -

+

-
playother -
- +
playother
+
(This command is new in protocol version 2. It is not sent unless you enable it with the feature command.) Leave force mode and set the engine to play the color that is not on @@ -582,42 +587,43 @@ the engine's clock with the color that is not on move. Start the opponent's clock. If pondering is enabled, the engine should begin pondering. If the engine later receives a move, it should start thinking and eventually reply. - -

+

-
white +
white
- +

(This command is obsolete as of protocol version 2, but is still sent in some situations to accommodate older engines unless you disable it with the feature command.) - + Set White on move. Set the engine to play Black. Stop clocks. -

+

+
-
black +
black
- + (This command is obsolete as of protocol version 2, but is still sent in some situations to accommodate older engines unless you disable it with the feature command.) - + Set Black on move. Set the engine to play White. Stop clocks. -

+

-
level MPS BASE INC +
level MPS BASE INC
Set time controls. See the Time Control section below. -

+

-
st TIME +
st TIME
Set time controls. See the Time Control section below. -

+

-
sd DEPTH -
The engine should limit its thinking to DEPTH ply. -The commands "level" or "st" and "sd" can be used together in an orthogonal way. -If both are issued, the engine should observe both limitations: +
sd DEPTH
+
+

The engine should limit its thinking to DEPTH ply. +The commands "level" or "st" and "sd" can be used together in an orthogonal way. +If both are issued, the engine should observe both limitations: In the protocol, the "sd" command isn't a time control. It doesn't say that your engine has unlimited time but must search to exactly the given depth. It says that you should pay attention to the time @@ -625,16 +631,16 @@ control as normal, but cut off the search at the specified depth even if you have time to search deeper. If you don't have time to search to the specified depth, given your normal time management algorithm, then you will want to stop sooner than the given depth. -

+

The "new" command should set the search depth back to unlimited. This is already stated in the spec. The "level" command should not affect the search depth. As it happens, xboard/WinBoard currently always sends sd (if needed) right after level, but that isn't part of the -spec. -

+spec.

+
-
nps NODE_RATE -
The engine should not use wall-clock time to make its timing decisions, +
nps NODE_RATE
+
The engine should not use wall-clock time to make its timing decisions, but an own internal time measure based on the number of nodes it has searched (and will report as "thinking output", see section 10), converted to seconds through dividing by the given NODE_RATE. @@ -645,79 +651,78 @@ rather than wall-clock time. This even holds if NODE_RATE is given as 0, but in that case it should also use the user CPU time for its timing decisions. The effect of an "nps" command should persist until the next "new" command. - -

+ +

-
time N +
time N
Set a clock that always belongs to the engine. N is a number in centiseconds (units of 1/100 second). Even if the engine changes to playing the opposite color, this clock remains with the engine. -

+

-
otim N +
otim N
-
Set a clock that always belongs to the opponent. N is a number in +

Set a clock that always belongs to the opponent. N is a number in centiseconds (units of 1/100 second). Even if the opponent changes to playing the opposite color, this clock remains with the opponent. -

+

If needed for purposes of board display in force mode (where the engine is not participating in the game) the time clock should be associated with the last color that the engine was set to play, the otim clock with the opposite color.

-This business of "clocks remaining with the engine" is apparently so ambiguous +This business of "clocks remaining with the engine" is apparently so ambiguous that many engines implement it wrong. The clocks in fact always remain with the color. Which clock reading is relayed with "time", and which by "otim", is determined by which side the engine plays. Note that the way the clocks operate and receive extra time (in accordance with the selected time control) is not affected in any way by which moves are made by the engine, which by the opponent, and which were forced. - +

- + Beginning in protocol version 2, if you can't handle the time and otim commands, you can use the "feature" command to disable them; see below. - + The following techniques from older protocol versions also work: You can ignore the time and otim commands (that is, treat them as no-ops), or send back "Error (unknown command): time" the first time you see "time". -

+

-
MOVE -
See below for the syntax of moves. If the move is illegal, print +
MOVE
+
+

See below for the syntax of moves. If the move is illegal, print an error message; see the section "Commands from the engine to xboard". If the move is legal and in turn, make it. If not in force mode, stop the opponent's clock, start the engine's clock, start thinking, and eventually make a move. -

+

When xboard sends your engine a move, it normally sends coordinate algebraic notation. Examples: -

+

- + + + + + + +
Normal moves:e2e4 -
Pawn promotion:e7e8q -
Castling:e1g1, e1c1, e8g8, e8c8 -
Bughouse/crazyhouse drop:P@h3 -
ICS Wild 0/1 castling:d1f1, d1b1, d8f8, d8b8 -
FischerRandom castling:O-O, O-O-O (oh, not zero) +
Normal moves:e2e4
Pawn promotion:e7e8q
Castling:e1g1, e1c1, e8g8, e8c8
Bughouse/crazyhouse drop:P@h3
ICS Wild 0/1 castling:d1f1, d1b1, d8f8, d8b8
FischerRandom castling:O-O, O-O-O (oh, not zero)
Multi-leg move:c4d5,d5e4 (legs separated by comma)
Null move:@@@@
-

- -Note that on boards with more than 9 ranks, counting of the ranks starts at 0. - +

+Note that on boards with exactly 10 ranks, counting of the ranks starts at 0.

-

- +

Beginning in protocol version 2, you can use the feature command to select SAN (standard algebraic notation) instead; for example, e4, Nf3, exd5, Bxf7+, Qxf7#, e8=Q, O-O, or P@h3. Note that the last form, P@h3, is a extension to the PGN standard's definition of SAN, which does not support bughouse or crazyhouse. -

@@ -727,38 +732,37 @@ passant availability. If xboard sends an illegal move, send back an error message so that xboard can retract it and inform the user; see the section "Commands from the engine to xboard".

- -
usermove MOVE -
+
+
usermove MOVE
+
By default, moves are sent to the engine without a command name; the notation is just sent as a line by itself. Beginning in protocol version 2, you can use the feature command to cause the command name "usermove" to be sent before the move. Example: "usermove e2e4". - -

+
-
? -
Move now. If your engine is thinking, it should move immediately; +
?
+

Move now. If your engine is thinking, it should move immediately; otherwise, the command should be ignored (treated as a no-op). It is permissible for your engine to always ignore the ? command. The only bad consequence is that xboard's Move Now menu command will do nothing. -

+

It is also permissible for your engine to move immediately if it gets any command while thinking, as long as it processes the command right after moving, but it's preferable if you don't do this. For example, xboard may send post, nopost, easy, hard, force, quit, - + or other commands - + while the engine is on move.

+
-
ping N -
- -In this command, N is a decimal number. When you receive the command, +
ping N
+
+

In this command, N is a decimal number. When you receive the command, reply by sending the string pong N, where N is the same number you received. Important: You must not reply to a "ping" command until you have finished executing all commands that you @@ -774,7 +778,7 @@ command. Similarly, xboard may send a sequence like "force", "new", "ping". You must not send the pong response until after you have finished executing the "new" command and are ready for the new game to start. - +

The ping command is new in protocol version 2 and will not be sent unless you enable it with the "feature" command. Its purpose is to @@ -784,18 +788,18 @@ implement it. It is especially important in simple engines that do not ponder and do not poll for input while thinking, but it is needed in all engines.

-
+
-
draw +
draw
The engine's opponent offers the engine a draw. To accept the draw, send "offer draw". To decline, ignore the offer (that is, send nothing). If you're playing on ICS, it's possible for the draw offer to have been withdrawn by the time you accept it, so don't assume the game is over because you accept a draw offer. Continue playing until xboard tells you the game is over. See also "offer draw" below. -

+

-
result RESULT {COMMENT} +
result RESULT {COMMENT}
After the end of each game, xboard will send you a result command. You can use this command to trigger learning. RESULT is either 1-0, 0-1, 1/2-1/2, or *, indicating whether white won, black won, the game @@ -826,56 +830,59 @@ front. You might not always get a "result *" command, however. In particular, you won't get one in local chess engine mode when the user stops playing by selecting Reset, Edit Game, Exit or the like.

+
-
setboard FEN -
+
setboard FEN
+
+

The setboard command is the new way to set up positions, beginning in protocol version 2. It is not used unless it has been selected with the feature command. Here FEN is a position in Forsythe-Edwards -Notation, as defined in the PGN standard. -Note that this PGN standard referred to here +Notation, as defined in the PGN standard. +Note that this PGN standard referred to here only applies to normal Chess; Obviously in variants that cannot be described by a FEN for normal Chess, e.g. because the board is not 8x8, other pieces then PNBRQK participate, there are holdings that need to be specified, etc., -xboard will use a FEN format that is standard or suitable for that varant. +xboard will use a FEN format that is standard or suitable for that variant. In particular, in FRC or CRC, WinBoard will use Shredder-FEN or X-FEN standard, i.e. it can use the rook-file indicator letter to represent a castling right (like HAha) whenever it wants, but if it uses KQkq, this will always refer -to the outermost rook on the given side. - +to the outermost rook on the given side. +

-

Illegal positions: Note that either setboard or edit can +

+Illegal positions: Note that either setboard or edit can be used to send an illegal position to the engine. The user can create any position with xboard's Edit Position command (even, say, an empty board, or a board with 64 white kings and no black ones). If your engine receives a position that it considers illegal, I suggest that you send the response "tellusererror Illegal position", and then respond to any attempted move with "Illegal move" until -the next new, edit, or setboard command.

-
-

+the next new, edit, or setboard command. +

+
-
edit +
edit
- +

The edit command is the old way to set up positions. For compatibility with old engines, it is still used by default, but new engines may prefer to use the feature command (see below) to cause xboard to use setboard instead. - + The edit command puts the chess engine into a special mode, where -it accepts the following subcommands: +it accepts the following subcommands:

- + + + +
cchange current piece color, initially white -
Pa4 (for example)place pawn of current color on a4 -
xa4 (for example)empty the square a4 (not used by xboard) -
#clear board -
.leave edit mode +
cchange current piece color, initially white
Pa4 (for example)place pawn of current color on a4
xa4 (for example)empty the square a4 (not used by xboard)
#clear board
.leave edit mode
- +

See the Idioms section below for additional subcommands used in ChessBase's implementation of the protocol. - +

The edit command does not change the side to move. To set up a black-on-move position, xboard uses the following command sequence: @@ -902,7 +909,7 @@ capture is assumed to be illegal on the current move regardless of the positions of the pawns. The clock for the 50 move rule starts at zero, and for purposes of the draw by repetition rule, no prior positions are deemed to have occurred. - + In FRC or CRC, any rook and king put on the back rank should be considered to have castling rights, even if it later becomes apparent that they cannot be both in the initial position, because the position just set up is asymmetric. @@ -910,66 +917,64 @@ It is upto WinBoard to find work-around in cases where this is not desired, similar to the "black kludge" shown above, by setting up an earlier position, and then do a move to destroy castling rights or create e.p. rights. (Don't bet your life on it...) - +

+
-
hint +
hint
If the user asks for a hint, xboard sends your engine the command "hint". Your engine should respond with "Hint: xxx", where xxx is a suggested move. If there is no move to suggest, you can ignore the hint command (that is, treat it as a no-op). -

+

-
bk +
bk
If the user selects "Book" from the xboard menu, xboard will send your engine the command "bk". You can send any text you like as the response, as long as each line begins with a blank space or tab (\t) character, and you send an empty line at the end. The text pops up in a modal information dialog. -

+

-
undo +
undo
If the user asks to back up one move, xboard will send you the "undo" command. xboard will not send this command without putting you in "force" mode first, so you don't have to worry about what should happen if the user asks to undo a move your engine made. (GNU Chess 4 actually switches to playing the opposite color in this case.) -

+

-
remove +
remove
If the user asks to retract a move, xboard will send you the "remove" command. It sends this command only when the user is on move. Your engine should undo the last two moves (one for each player) and continue playing the same color. -

+

-
hard +
hard
Turn on pondering (thinking on the opponent's time, also known as "permanent brain"). xboard will not make any assumption about what your default is for pondering or whether "new" affects this setting. -

+

-
easy -
Turn off pondering. -

+

easy
+
Turn off pondering.
-
post +
post
Turn on thinking/pondering output. -See Thinking Output section. -

+See Thinking Output section.

-
nopost -
Turn off thinking/pondering output. -

+

nopost
+
Turn off thinking/pondering output.
-
analyze -
Enter analyze mode. See Analyze Mode section. -

+

analyze
+
Enter analyze mode. See Analyze Mode section.
-
name X
This command informs the engine of its +
name X
+
This command informs the engine of its opponent's name. When the engine is playing on a chess server, xboard obtains the opponent's name from the server. - + When the engine is playing locally against a human user, xboard obtains the user's login name from the local operating system. When the engine is playing @@ -979,41 +984,40 @@ option to the feature command. By default, xboard uses the name command only when the engine is playing on a chess server. Beginning in protocol version 2, you can change this with the name option to the feature command; see below. - -

+ +

-
rating +
rating
In ICS mode, xboard obtains the ICS opponent's rating from the "Creating:" message that appears before each game. (This message may not appear on servers using outdated versions of the FICS code.) In Zippy mode, it sends these ratings on to the chess engine using the "rating" command. The chess engine's own rating comes first, and if either opponent is not rated, his rating is given as 0. - + In the future this command may also be used in other modes, if ratings are known. - + Example:
rating 2600 1500
-

+

-
ics HOSTNAME -
+
ics HOSTNAME
+
If HOSTNAME is "-", the engine is playing against a local opponent; otherwise, the engine is playing on an Internet Chess Server (ICS) with the given hostname. This command is new in protocol version 2 and is not sent unless the engine has enabled it with the "feature" command. Example: "ics freechess.org" - -

+

-
computer +
computer
The opponent is also a computer chess engine. Some engines alter their playing style when they receive this command. -

+

-
pause -
resume -
(These commands are new in protocol +
pause
+
resume
+
(These commands are new in protocol version 2 and will not be sent unless feature pause=1 is set. At this writing, xboard actually does not use the commands at all, but it or other interfaces may use them in the future.) @@ -1025,11 +1029,10 @@ send to the engine while it is in the paused state is "resume". The paused thinking or pondering (if any) resumes from exactly where it left off, and the clock of the player on move resumes running from where it stopped. - -

+

-
memory N -
+
memory N
+
This command informs the engine on how much memory it is allowed to use maximally, in MegaBytes. On receipt of this command, the engine should adapt the size of its hash tables accordingly. This command does only fix the total memory use, @@ -1040,11 +1043,10 @@ how to divide up the available memory between the various tables it wants to use This command will only be sent to engines that have requested it through the memory feature, and only at the start of a game, as the first of the commands to relay engine option settings just before each "new" command. - -

+

-
cores N -
+
cores N
+
This command informs the engine on how many CPU cores it is allowed to use maximally. This could be interpreted as the number of search threads for SMP engines. (Threads that do not consume significant amounts of CPU time, like I/O threads, need not be included in the count.) @@ -1054,11 +1056,10 @@ but it is allowed to finish a search in progress before procesing the command. (Obeying the command should take priority over finishing a ponder search, though.) In any case it will be sent at the start of every game as the last command to relay engine option settings before the "new" command. - -

+

-
egtpath TYPE PATH -
+
egtpath TYPE PATH
+
This command informs the engine in which directory (given by the PATH argument) it can find end-game tables of the specified TYPE. The TYPE argument can be any character string which does not contain spaces. @@ -1074,11 +1075,10 @@ It is upto the developer of the EGT format to specify the syntax of this paramet This command will only be sent to engines that have told the GUI they support EGTs of the given TYPE through the egt feature. It will be sent at the start of each game, before the "new" command. - -

+

-
option NAME[=VALUE] -
+
option NAME[=VALUE]
+
This command changes the setting of the option NAME defined by the engine (through an earlier feature command) to the given VALUE. @@ -1094,7 +1094,60 @@ specified in this feature command, i.e. with 'spin' and 'check' options VALUE will be a decimal integer (in the latter case 0 or 1), with 'combo' and 'string' options VALUE will be a text string, and with 'button' and 'save' options no VALUE will be sent at all. - +
+ +
exclude MOVE
+
include MOVE
+
exclude all
+
include all
+
+These commands change the set of moves that the engine should consider in the root node of its search, +by removing or adding the mentioned MOVE from this set. +After reaching a new position, (e.g. through a usermove, undo, new or setboard command), +or after receiving "include all", +this set should always be reset to all legal moves from that position. +If the set of moves changes during a search, +the engine could start a new search from scratch, or it can try to be smart, +and continue the current search with the new set of moves +(e.g. after exclusion of a move that has not been searched yet in the current iteration). +After "exclude all", the engine would have no legal moves in the root, +which logically should make it behave as if it is (stale)mated, +but it is allowed to defer any effects of this command on a search in progress +to when the set gets non-empty again through addition of a move. +These commands will only be sent to engines that have requested such through the exclude feature. +
+ +
setscore SCORE DEPTH
+
+This command instructs the engine to treat future search requests on the current position +(also when it is encountered inside a larger search tree) +upto the given DEPTH as if these result is SCORE centi-Pawn in favor of the side that has the move in this position. +It is entirely up to the engine to decide when the effect of this option should expire. +(E.g. it could last upto the next "new" or "quit" command, +or even into future sessions until the user explicitly clears it through an engine-defined option.) +This command will only be sent to engines that have requested it through the setscore feature. +
+ +
lift SQUARE
+
put SQUARE
+
hover SQUARE
+
+These commands are only important for variants the GUI does not know the rules of, +and keep the engine aware of how the user is manipulating pieces in the GUI, +so that it can supply relevant rule information. +The "lift" command is sent by the GUI when the user 'picks up' (or selects) a piece from the mentioned SQUARE, +so that the engine can reply with a "highlight" command to mark the squares where that piece can move to. +The "put" command similarly indicates where the user releases that piece; +as the GUI clears the highlights on that event by itself, usually no engine response would be required. +For promotion moves you can get a double "put" command, the first one sent when the piece lands on the square, +without being decided yet what it promotes to, so the engine can send a "choice" command to +specify the promotion choice the GUI should offer when promotion wasn't already implied by the "lift" location. +The "hover" command is sent whenever the mouse pointer enters a square that is currently marked in red, +(reserved for captures) +so that the engine can (optionally) reply with a "highlight" command to mark victims of non-standard capture +(such as e.p. capture in Chess, or jump capture in Checkers) when the user would move the currently selected piece there. +These commands will only be sent to engines that have requested such through the highlight feature. +

Bughouse commands:

@@ -1111,45 +1164,41 @@ be added in the future.

-
partner <player> +
partner <player>
<player> is now your partner for future games. Example:
partner mann
-

+

-
partner +
partner
Meaning: You no longer have a partner. -

+

-
ptell <text> +
ptell <text>
Your partner told you <text>, either with a ptell or an ordinary tell. -

+

-
holding [<white>] [<black>] +
holding [<white>] [<black>]
White currently holds <white>; black currently holds <black>. - Example:
holding [PPPRQ] []
+ Example:
holding [PPPRQ] []
-
holding [<white>] [<black>] <color><piece> +
holding [<white>] [<black>] <color><piece>
White currently holds <white>; black currently holds <black>, after - <color> acquired <piece>. Example:
holding [PPPRQ] [R] BR
+ <color> acquired <piece>. Example:
holding [PPPRQ] [R] BR

9. Commands from the engine to xboard

-

- +

In general, an engine should not send any output to xboard that is not described in this document. As the protocol is extended, newer versions of xboard may recognize additional strings as commands that were previously not assigned a meaning. -

-
-feature FEATURE1=VALUE1 FEATURE2=VALUE2 ... - -
-Beginning with version 2, the protocol includes the "feature" +
feature FEATURE1=VALUE1 FEATURE2=VALUE2 ...
+
+

Beginning with version 2, the protocol includes the "feature" command, which lets your engine control certain optional protocol features. Feature settings are written as FEATURE=VALUE, where FEATURE is a name from the list below and VALUE is the value to be @@ -1158,7 +1207,7 @@ type of value is listed for each feature. String values are written in double quotes (for example, feature myname="Miracle Chess 0.9"), integers are written in decimal, and boolean values are written as 0 for false, 1 for true. Any number of features can be set -in one feature command, or multiple feature commands can be given. +in one feature command, or multiple feature commands can be given.

Your engine should send one or more feature commands immediately after @@ -1212,127 +1261,104 @@ protocol version by rejecting some features that are defined in that version; however, you should realize that engine authors are likely to code for xboard and may not be prepared to have a feature that they depend on be rejected. +If the GUI rejects an option feature because of the +syntax of the value, it should print the value string with the +"rejected" command, e.g. "rejected option nonsense" in response +to receiving feature option="nonsense".

Here are the features that are currently defined.

-
-
-ping (boolean, default 0, recommended 1) - -
+
ping (boolean, default 0, recommended 1)
+
If ping=1, xboard may use the protocol's new "ping" command; if ping=0, xboard will not use the command. - +
-
-setboard (boolean, default 0, recommended 1) - -
+
setboard (boolean, default 0, recommended 1)
+
If setboard=1, xboard will use the protocol's new "setboard" command to set up positions; if setboard=0, it will use the older "edit" command. - +
-
-playother (boolean, default 0, recommended 1) - -
+
playother (boolean, default 0, recommended 1)
+
If playother=1, xboard will use the protocol's new "playother" command when appropriate; if playother=0, it will not use the command. - +
-
-san (boolean, default 0) - -
+
san (boolean, default 0)
+
If san=1, xboard will send moves to the engine in standard algebraic notation (SAN); for example, Nf3. If san=0, xboard will send moves in coordinate notation; for example, g1f3. See MOVE in section 8 above for more details of both kinds of notation. - +
-
-usermove (boolean, default 0) - -
+
usermove (boolean, default 0)
+
If usermove=1, xboard will send moves to the engine with the command "usermove MOVE"; if usermove=0, xboard will send just the move, with no command name. - +
-
-time (boolean, default 1, recommended 1) - -
+
time (boolean, default 1, recommended 1)
+
If time=1, xboard will send the "time" and "otim" commands to update the engine's clocks; if time=0, it will not. - +
-
-draw (boolean, default 1, recommended 1) - -
+
draw (boolean, default 1, recommended 1)
+
If draw=1, xboard will send the "draw" command if the engine's opponent offers a draw; if draw=0, xboard will not inform the engine about draw offers. Note that if draw=1, you may receive a draw offer while you are on move; if this will cause you to move immediately, you should set draw=0. - +
-
-sigint (boolean, default 1) - -
+
sigint (boolean, default 1)
+
If sigint=1, xboard may send SIGINT (the interrupt signal) to the engine as section 7 above; if sigint=0, it will not. - +
-
-sigterm (boolean, default 1) - -
+
sigterm (boolean, default 1)
+
If sigterm=1, xboard may send SIGTERM (the termination signal) to the engine as section 7 above; if sigterm=0, it will not. - +
-
-reuse (boolean, default 1, recommended 1) - -
+
reuse (boolean, default 1, recommended 1)
+
If reuse=1, xboard may reuse your engine for multiple games. If reuse=0 (or if the user has set the -xreuse option on xboard's command line), xboard will kill the engine process after every game and start a fresh process for the next game. - +
-
-analyze (boolean, default 1, recommended 1) - -
+
analyze (boolean, default 1, recommended 1)
+
If analyze=0, xboard will not try to use the "analyze" command; it will pop up an error message if the user asks for analysis mode. If analyze=1, xboard will try to use the command if the user asks for analysis mode. - +
-
-myname (string, default determined from engine filename) - -
+
myname (string, default determined from engine filename)
+
This feature lets you set the name that xboard will use for your engine in window banners, in the PGN tags of saved game files, and when sending the "name" command to another engine. - +
-
-variants (string, see text below) - -
+
variants (string, see text below)
+
This feature indicates which chess variants your engine accepts. It should be a comma-separated list of variant names. See the table under the "variant" command in section 8 above. If @@ -1343,59 +1369,57 @@ Zippy mode.) It is recommended that you set this feature to the correct value for your engine (just "normal" in most cases) rather than leaving the default in place, so that the user will get an appropriate error message if he tries to play a variant that your -engine does not support. -
-If your engine can play variants on a deviating board size, +engine does not support. +As of XBoard 4.8 a variant name not known to the GUI will be +considered an engine-defined variant. +The user will be given the opportunity to select such variants, +but when this happens, the engine should define its meaning +in detail with the aid of a "setup" command defined below, +in order to avoid an error. +
+If your engine can play variants on a deviating board size, like capablanca on an 8x8 board, or capablanca crazyhouse, -it can list them amongst the variants with a prefix spcifying board size plus +it can list them amongst the variants with a prefix specifying board size plus holdings size, like 8x8+0_capablanca or 10x8+7_capablanca. If it is capable of playing any variant with an arbitrary board size, it should list "boardsize" as one of the variants. If there is a maximum to the board size, this can be prefixed, e.g. "12x10+0_boardsize". -
+ +
-
-colors (boolean, default 1, recommended 0) - -
+
colors (boolean, default 1, recommended 0)
+
If colors=1, xboard uses the obsolete "white" and "black" commands in a stylized way that works with most older chess engines that require the commands. See the "Idioms" section below for details. If colors=0, xboard does not use the "white" and "black" commands at all. - + +
-
-ics (boolean, default 0) - -
+
ics (boolean, default 0)
+
If ics=1, xboard will use the protocol's new "ics" command to inform the engine of whether or not it is playing on a chess server; if ics=0, it will not. - +
-
-name (boolean, see text below) - -
+
name (boolean, see text below)
+
If name=1, xboard will use the protocol's "name" command to inform the engine of the opponent's name; if name=0, it will not. By default, name=1 if the engine is playing on a chess server; name=0 if not. - +
-
-pause (boolean, default 0) - -
+
pause (boolean, default 0)
+
If pause=1, xboard may use the protocol's new "pause" command; if pause=0, xboard assumes that the engine does not support this command. - +
-
-nps (boolean, default ?) - -
+
nps (boolean, default ?)
+
If nps=1, it means the engine supports the nps command. If nps=0, it means the engine does not support it, and WinBoard should refrain from sending it. Default is that WinBoard sends it, in an attempt to try out if the engine understand it. @@ -1403,12 +1427,10 @@ The engine should properly respond with "Error (unkown command): nps" if it does (as any protocol version pre-scribes), or WinBoard might assume that the engine did understand the command. In that case the use of different time standards that ensues could lead to time forfeits for the engine. - +
-
-debug (boolean, default 0) - -
+
debug (boolean, default 0)
+
If debug=1, it means the engine wants to send debug output prefixed by '#', which WinBoard should ignore, except for including it in the winboard.debug file. As this feature is added to protocol 2 ony late, @@ -1417,64 +1439,61 @@ it is important that engines check if WinBoard accepts the feature. If the feature is rejected, engines must refrain from sending the debug output, or do so at their own risk. - +
-
-memory (boolean, default 0) - -
+
memory (boolean, default 0)
+
If memory=1, the size of the total amount of memory available for the memory-consuming tables of the engine (e.g. hash, EGTB cache) will be set by the GUI through the "memory" command. - +
-
-smp (boolean, default 0) - -
+
smp (boolean, default 0)
+
If smp=1, the GUI will send the "cores" command to the engine to inform it how many CPU cores it can use. Note that sending smp=1 does not imply the engine can use more than one CPU; just that it wants to receive the "cores" command. - +
-
-egt (string, see text below) - -
+
egt (string, see text below)
+
This feature indicates which end-game table formats the engine supports. It should be a comma-separated list of format names. See under the "egtpath" command in section 8 above. If you do not set this feature, xboard will assume the engine does not support end-game tables, and will not send any "egtpath" commands to inform the engine about their whereabouts. - +
-
-option (string, see text below) - -
+
option (string, see text below)
+
This feature is used by the engine to define an option command to appear in a GUI menu, -so that the user can change the corresponding setting of the engine through the GUI. +so that the user can change the corresponding setting of the engine through the GUI interactively. The string describes the option by defining a name, type, current value and (sometimes) the acceptable value range. -There are nine different options types, each requiring a slighly different syntax of the defining string: -
+Unlike other features, option features are accumulated by the GUI, +and the GUI must be able to add a new option to the list at any time, +even after having received feature done=1. +There are ten different options types, each requiring a slighly different syntax of the defining string: +
feature option="NAME -button" -
+
feature option="NAME -save" -
+
+feature option="NAME -reset" +
feature option="NAME -check VALUE" -
+
feature option="NAME -string VALUE" -
+
feature option="NAME -spin VALUE MIN MAX" -
+
feature option="NAME -combo CHOICE1 /// CHOICE2 ..." -
+
feature option="NAME -slider VALUE MIN MAX" -
+
feature option="NAME -file VALUE" -
+
feature option="NAME -path VALUE" -
+
NAME is an arbitrary alphanumeric string which can contain spaces; the other words in capitals would be replaced by the current (default) setting of the option, (a character string for -string options, a decimal number for -spin and -check options, @@ -1483,31 +1502,121 @@ the minimum or maximum value of numeric (-spin) options, or arbitrary text labels (for -combo option). In the latter case, the current value will be preceded by an asterisk. The -file and -path options are similar to -string, but can be used to inform the GUI that -the text represents a file name or folder name respectively, so the GUI dialog to set it -could add the appropriate browse button to the text-edit field. +the text represents a file name or folder name respectively, +so the GUI dialog could add the appropriate browse button to the text-edit field. Similarly, a -slider option is like a -spin, but the GUI might make a different graphical representation for it. A -save option is like a -button, and defines an immediate command to be sent by the engine. With -save the GUI will make sure all current option settings are flushed to the engine before it sends this command. -
- -
-done (integer, no default) - -
+A -reset option is like a -button, but use of it purges the list of options before sending +the corresponding option command to the engine. +This enables the engine to completely redefine its options or their current settings, +by sending a new set of option feature commands to the GUI, +terminated by feature done=1. +(The effect of sending an option feature for an option with the same name as was defined before, +without first receiving a -reset option command, is undefined.) + +
+ +
exclude (boolean, default 0)
+
+If exclude=1 the GUI can send "exclude" and "include" commands to control which moves +from the root position should be searched. +
+ +
setscore (boolean, default 0)
+
+If setscore=1 the GUI can send "setscore" commands to define the score of the current position. +
+ +
highlight (boolean, default 0)
+
+If highlight=1 the GUI will send "lift", "put" and "hover" commands to the engine, +to keep the latter aware of the user's piece manipulation before the move entry is completed, +so it can respond with the proper "highlight" and "click" commands. +
+ +
done (integer, no default)
+
If you set done=1 during the initial two-second timeout after xboard sends you the "xboard" command, the timeout will end and xboard will not look for any more feature commands before starting normal operation. If you set done=0, the initial timeout is increased to one hour; in this case, you must set done=1 before xboard will enter normal operation. - + +
-

- -

Illegal move: MOVE -
Illegal move (REASON): MOVE + +

+ +
setup FEN
+
setup (PIECETOCHAR) FEN
+
setup (PIECETOCHAR) WxH+S_PARENTVARIANT FEN
+
The engine can optionally send a setup command to the GUI in reply +to the variant command. +In the simplest form this sends the FEN of the initial position. +This can be used to implement engines for non-standard variants +that only differ from standard variants through the initial position. +(E.g. many of the 'wild' boards you can play on an ICS.) +Whether the GUI should obey or ignore this command depends on the situation. +Normally it would ignore it in variants where it knows the standard initial position +and legality testing is on, or when the user specified an initial position. +In other cases it will use the FEN sent by the first engine +for setting up the initial position, as if it was an externally supplied position. +Such a position will always be sent to a second engine that might be involved, +and any setup commands received from the latter will always be ignored. +(This to allow for shuffle games, where the two engines might pick different setups.) +When no initial position is known, such as for 'catch-all' variants like fairy, +or whenever the board width is overruled to a non-standard value, +the FEN will be used as default initial position even when legality testing is on. +

+Optionally the meaning of the piece ID letters in the FEN can be defined +between parentheses; this will be interpreted as if it was the value of a +-pieceToCharTable command-line option, mapping letters to GUI piece types. +Also optionally behind that, the setup command can specify board width W, +board height H and holdings size S, as well as a 'parent variant'. +This is typically done in response to a variant command with a non-standard name, +about which the GUI is not supposed to know anything at all. +The engine can then specify board size, participating pieces, initial setup, +and other rule details (inherited from the parent variant), +saving the user the trouble to configure the GUI for this non-standard variant. +Example: +

+  setup (PN.RQKpn.rqk) 6x6+0_fairy rnqknr/pppppp/6/6/PPPPPP/RNQKNR w - - 0 1
+
+could be used by an engine for Los-Alamos Chess in response to 'variant losalamos', +and would automatically switch the GUI to this variant as soon as the user +selected it from the GUI menu. +The PIECETOCHAR element would ensure a Bishop would not be accepted as promotion choice. +

+
+ +
piece ID PIECEDESC
+
The engine can send one or more piece commands +in response to a variant command, in order to specify that the piece +indicated by ID moves in a non-standard way in this variant. +(This to enable the GUI to reliably perform mate detection, and produce good SAN.) +Like in FEN the ID is a case-sensitive letter, specifying the color. +When it is a capital suffixed by &, the description is valid for both colors. +PIECEDESC describes the moves in 'Betza notation', +basically a concatenation of one-letter (upper-case) codes for all of its moves. +These codes can be prefixed with lower-case 'modifiers' to indicate directional sub-sets +(combinations of fblrvs, if the piece is not totally symmetric), +move modality (non-capture, capture, e.p. capture; mce), +and whether the move can jump directly to its destination, +or can be blocked (n). +Moves only valid for a virgin piece are prefixed by 'i'. +An optional numeric suffix on the move indicates the maximum number of times +the move can be repeated in the same direction, +to indicate sliders / riders (with the convention 0 = infinite). + +
+

+ +
Illegal move: MOVE
+
Illegal move (REASON): MOVE
If your engine receives a MOVE command that is recognizably a move but is not legal in the current position, your engine must print an error message in one of the above formats so that xboard can pass the @@ -1524,8 +1633,9 @@ Generally, xboard will never send an ambiguous move, so it does not matter whether you respond to such a move with an Illegal move message or an Error message.

+
-
Error (ERRORTYPE): COMMAND +
Error (ERRORTYPE): COMMAND
If your engine receives a command it does not understand or does not implement, it should print an error message in the above format so that xboard can parse it. Examples: @@ -1535,23 +1645,25 @@ that xboard can parse it. Examples: Error (command not legal now): undo Error (too many parameters): level 1 2 3 4 5 6 7 +
-
move MOVE +
move MOVE
Your engine is making the move MOVE. Do not echo moves from xboard with this command; send only new moves made by the engine. - +

For the actual move text from your chess engine (in place of MOVE -above), your move should be either +above), your move should be either

  • in coordinate notation (e.g., e2e4, e7e8q) with castling indicated by the King's two-square move (e.g., -e1g1), or +e1g1), or
  • in Standard Algebraic Notation (SAN) as defined in the Portable Game Notation standard (e.g, e4, Nf3, O-O, cxb5, Nxe4, e8=Q), with the extension piece@square (e.g., P@f7) to handle piece placement -in bughouse and crazyhouse. +in bughouse and crazyhouse.
+

xboard itself also accepts some variants of SAN, but for compatibility with non-xboard interfaces, it is best not to rely on this behavior.

@@ -1568,9 +1680,16 @@ engine to send SAN to the interface only if you have set feature san=1 (which causes the interface to send SAN to you) and have received "accepted san" in reply.

-
-
RESULT {COMMENT}
When your engine detects +

+For a multi-leg move, each leg will have to be sent in a separate "move" command, +a comma at the end of all non-final legs indicating there is more to follow. +

+ +
+ +
RESULT {COMMENT}
+
When your engine detects that the game has ended by rule, your engine must output a line of the form "RESULT {comment}" (without the quotes), where RESULT is a PGN result code (1-0, 0-1, or 1/2-1/2), and comment is the reason. Here @@ -1589,50 +1708,51 @@ Examples:

xboard relays the result to the user, the ICS, the other engine in Two Machines mode, and the PGN save file as required. -Note that "definitey over" above means that sending this command +Note that "definitey over" above means that sending this command will be taken by WinBoard as an unconditional refusal of the engine to play on, which might cause you to forfeit if the game was in fact not over. This command should thus not be used to offer draws, accept draws, or make draw-by-rule claims that are not yet valid in the current position (but will be after you move). -For offering and claiming such draws, "offer draw" should be used. -

- +For offering and claiming such draws, "offer draw" should be used. +

+ +

Note that (in accordance with FIDE rules) only KK, KNK, KBK and KBKB with all bishops on the same color can be claimed as draws on the basis of insufficient mating material. The end-games KNNK, KBKN, KNKN and KBKB with unlike bishops do have mate positions, and cannot be claimed. Complex draws based on locked Pawn chains will not be recognized as draws by most interfaces, so do not claim in such positions, but just offer a draw or play on. - -

- +

+ +

Note to GUI programmers: RESULT commands that the engine sends immediately after its move might be detected by the GUI only after the opponent has moved, because of communication and scheduling delays, no matter how fast the engine sent it. Any judgement of the validity of RESULT claims based on te "current" board position will have to account for this uncertainty. -

+
-
resign +
resign
If your engine wants to resign, it can send the command "resign". Alternatively, it can use the "RESULT {comment}" command if the string "resign" is included in the comment; for example "0-1 {White resigns}". xboard relays the resignation to the user, the ICS, the other engine in Two Machines mode, and the PGN save file as required. -Note that many interfaces work more smoothly if you resign before -you move. -

+Note that many interfaces work more smoothly if you resign before +you move. +

-
offer draw +
offer draw
If your engine wants to offer a draw by agreement (as opposed to claiming a draw by rule), it can send the command "offer draw". xboard relays the offer to the user, the ICS, the other engine in Two Machines mode, and the PGN save file as required. In Machine White, Machine Black, or Two Machines mode, the offer is considered valid until your engine has made two more moves. -This command must also be used to accept a draw offer. +This command must also be used to accept a draw offer. Do not use the 1/2-1/2 command for that, as the offer might be no longer valid, in which case a refusal to play on implied by the RESULT command might make you forfeit the game. "offer draw" should also be used to claim 50-move and 3-fold-repetition draws @@ -1641,11 +1761,11 @@ WinBoard will grant draw offers without the opponent having any say in it in situations where draws can be claimed. Only if the draw cannot be claimed, the offer will be passed to your opponent after you make your next move, just before WinBoard relays this move to the opponent. - -

+ +

-
tellopponent MESSAGE -
+
tellopponent MESSAGE
+
This command lets the engine give a message to its opponent, independent of whether the opponent is a user on the local machine or a remote ICS user (Zippy mode). MESSAGE consists of any characters, @@ -1654,19 +1774,19 @@ playing against a user on the local machine, xboard pops up an information dialog containing the message. When the engine is playing against an opponent on the ICS (Zippy mode), xboard sends "say MESSAGE\n" to the ICS. -

+

-
tellothers MESSAGE -
This command lets the engine give a message to people watching the +
tellothers MESSAGE
+
This command lets the engine give a message to people watching the game other than the engine's opponent. MESSAGE consists of any characters, including whitespace, to the end of the line. When the engine is playing against a user on the local machine, this command does nothing. When the engine is playing against an opponent on the ICS (Zippy mode), xboard sends "whisper MESSAGE\n" to the ICS. -

+

-
tellall MESSAGE -
This command lets the engine give a message to its opponent and +
tellall MESSAGE
+
This command lets the engine give a message to its opponent and other people watching the game, independent of whether the opponent is a user on the local machine or a remote ICS user (Zippy mode). MESSAGE consists of any characters, @@ -1675,54 +1795,98 @@ playing against a user on the local machine, xboard pops up an information dialog containing the message. When the engine is playing against an opponent on the ICS (Zippy mode), xboard sends "kibitz MESSAGE\n" to the ICS. - -

+

-
telluser MESSAGE +
telluser MESSAGE
xboard pops up an information dialog containing the message. MESSAGE consists of any characters, including whitespace, to the end of the line. -

+

-
tellusererror MESSAGE +
tellusererror MESSAGE
xboard pops up an error dialog containing the message. MESSAGE consists of any characters, including whitespace, to the end of the line. -

+

-
askuser REPTAG MESSAGE +
askuser REPTAG MESSAGE
Here REPTAG is a string containing no whitespace, and MESSAGE consists of any characters, including whitespace, to the end of the line. xboard pops up a question dialog that says MESSAGE and has a typein box. If the user types in "bar", xboard sends "REPTAG bar" to the engine. The user can cancel the dialog and send nothing. -

+

-
tellics MESSAGE +
tellics MESSAGE
In Zippy mode, xboard sends "MESSAGE\n" to ICS. MESSAGE consists of any characters, including whitespace, to the end of the line. -

+

-
tellicsnoalias MESSAGE -
+
tellicsnoalias MESSAGE
+
In Zippy mode, xboard sends "xMESSAGE\n" to ICS, where "x" is a character that prevents the ICS from expanding command aliases, if xboard knows of such a character. (On chessclub.com and chess.net, "/" is used; on freechess.org, "$" is used.) MESSAGE consists of any characters, including whitespace, to the end of the line. - -

+

-
# COMMENT -
+
# COMMENT
+
The engine can send any string of printable characters, terminated by a newline, for inclusion in the winboard.debug file, provided the line starts with a '#' character. If the engine has set feature debug=1, it is guaranteed that WinBoard (and any future version of it) will completely ignore these lines in any other respect. - +
+ +
highlight COLORFEN
+
+Through this command the engine can apply markers to the board squares, +of the same type as the GUI uses for indicating where the user could put down a piece he grabs. +The COLORFEN is a construct similar to the board part of a FEN, +in which the letters indicate colors rather than piece types. +Eight colors are available, through the single-letter codes: RYGCBMWD, +for red, yellow, green, cyan, blue, magenta, white, black ('dark'), respectively. +For example, "highlight 8/8/8/8/4y3/4yr2/8/8" would mark e3 and e4 yellow, and f3 red. +Some colors have special meaning to the GUI: + + + + + + +
colorused foreffect
redcapturehovering over the square makes the GUI send a "hover" command
magentapromotionmoving to the square will be treated by the GUI as a promotion
cyanmulti-movemoving to the square will not complete the move entry
greenvictimsno real effect, but used by convention to indicate capture victims on "hover"
+The GUI will use the markers for legality checking, +and will consider moves to squares left non-marked in a highlight command as illegal even when legality checking is off. +This way the GUI can be made aware of the rules of unknown variants, +popping up promotion dialogs where it would otherwise not, +and knowing where to wait for more input on multi-leg moves. +When it would be necessary to mark squares where no legal moves go to +(e.g. to indicate side effects), +the corresponding lower-case character can be used for the color. +For indicating a legal destination square without visibly marking it, T (transparent) can be used. +
+ +
choice PIECESTRING
+
+This command can be sent to the GUI in response to a 'lift' or 'put' command that implies a promotion move, +to alter the choice offered to the user for the promotion piece from what the GUI would naturally assume, +to the piece IDs mentioned in the PIECESTRING. +The IDs in that string should be given as capitals irrespective of color. +The first piece mentioned will be the default choice. +
+
+ +
click SQUARE
+
+The GUI will treat this command as if the user had clicked the mentioned SQUARE. +This can be used to implement one-click moving in variants the GUI does not know the rules of +(having the engine send the clicks needed to complete the move). +It can also be used to implement side effects of the move the GUI would not know about +(e.g. moving the Rook in a non-standard castling). +
-

10. Thinking Output

@@ -1738,19 +1902,48 @@ output should be in the following format:
ply score time nodes pv
-Where: +

Where:

- + + + + + + + +
plyInteger giving current search depth. -
scoreInteger giving current evaluation in centipawns. -
timeCurrent search time in centiseconds (ex: -1028 = 10.28 seconds). - -
nodesNodes searched. -
pvFreeform text giving current "best" line. +
plyInteger giving current search depth.
scoreInteger giving current evaluation in centipawns.
timeCurrent search time in centiseconds (ex:1028 = 10.28 seconds).
nodesNodes searched.
*selective depthMaximium length of any branch in the current search.
*speedNodes per second in last measured time interval.
*Reserved for future extensions.
*tbhitsNumber of tablebase probes made in the current search.
pvFreeform text giving current "best" line. You can continue the pv onto another line if you start each -continuation line with at least four space characters. +continuation line with at least four space characters.
+

+The items marked with * are optional. +If any of these items is present, the pv field must be preceeded directly by a tab character; +if no tab character preceeds the first non-integer token, +the pv field will start at the first non-blank character after nodes. +Otherwise it will start after the last tab that is not behind any non-integer token. +Of all integers between nodes and pv the last one is intepreted as tbhits. +Of any remaining ones the first is interpreted as selective depth, +and a second as speed. +More infos could be added to this in the future. +Note that older interfaces might consider the optional infos to be part of the pv field, +and display them exactly as sent. +It is therefore encouraged that engines use tabs or spaces to format this optional info +so that it will display nicely in (not too wide) columns. +

+ +

+A question mark as the last character in the pv field should be used to indicate +the reported score is from a fail low, and thus represents an upper bound only. +Similarly, an exclamation point should be used to indicate a fail high / lower bound. +

+ +

+Mate scores should be indicated as 100000 + N for "mate in N moves", +and -100000 - N for "mated in N moves". +

+

Example:

@@ -1761,12 +1954,14 @@ Example: Meaning:

-9 ply, score=1.56, time = 10.84 seconds, nodes=48000, -PV = "Nf3 Nc6 Nc3 Nf6" +
+9 ply, score=1.56, time = 10.84 seconds, nodes=48000, PV = "Nf3 Nc6 Nc3 Nf6"
+

Longer example from actual Crafty output:

+
   4    109      14   1435  1. e4 d5 2. Qf3 dxe4 3. Qxe4 Nc6
   4    116      23   2252  1. Nf3 Nc6 2. e4 e6
@@ -1797,25 +1992,25 @@ units.  Example:
 
  2.     14    0       38   d1d2  e8e7 
  3+     78    0       65   d1d2  e8e7  d2d3 
- 3&     14    0       89   d1d2  e8e7  d2d3 
- 3&     76    0      191   d1e2  e8e7  e2e3 
+ 3&     14    0       89   d1d2  e8e7  d2d3 
+ 3&     76    0      191   d1e2  e8e7  e2e3 
  3.     76    0      215   d1e2  e8e7  e2e3 
- 4&     15    0      366   d1e2  e8e7  e2e3  e7e6 
+ 4&     15    0      366   d1e2  e8e7  e2e3  e7e6 
  4.     15    0      515   d1e2  e8e7  e2e3  e7e6 
  5+     74    0      702   d1e2  f7f5  e2e3  e8e7  e3f4 
- 5&     71    0     1085   d1e2  e8e7  e2e3  e7e6  e3f4 
+ 5&     71    0     1085   d1e2  e8e7  e2e3  e7e6  e3f4 
  5.     71    0     1669   d1e2  e8e7  e2e3  e7e6  e3f4 
- 6&     48    0     3035   d1e2  e8e7  e2e3  e7e6  e3e4  f7f5  e4d4 
+ 6&     48    0     3035   d1e2  e8e7  e2e3  e7e6  e3e4  f7f5  e4d4 
  6.     48    0     3720   d1e2  e8e7  e2e3  e7e6  e3e4  f7f5  e4d4 
- 7&     48    0     6381   d1e2  e8e7  e2e3  e7e6  e3e4  f7f5  e4d4 
+ 7&     48    0     6381   d1e2  e8e7  e2e3  e7e6  e3e4  f7f5  e4d4 
  7.     48    0    10056   d1e2  e8e7  e2e3  e7e6  e3e4  f7f5  e4d4 
- 8&     66    1    20536   d1e2  e8e7  e2e3  e7e6  e3d4  g7g5  a2a4  f7f5 
+ 8&     66    1    20536   d1e2  e8e7  e2e3  e7e6  e3d4  g7g5  a2a4  f7f5 
  8.     66    1    24387   d1e2  e8e7  e2e3  e7e6  e3d4  g7g5  a2a4  f7f5 
- 9&     62    2    38886   d1e2  e8e7  e2e3  e7e6  e3d4  h7h5  a2a4  h5h4 
+ 9&     62    2    38886   d1e2  e8e7  e2e3  e7e6  e3d4  h7h5  a2a4  h5h4 
                            d4e4 
  9.     62    4    72578   d1e2  e8e7  e2e3  e7e6  e3d4  h7h5  a2a4  h5h4 
                            d4e4 
-10&     34    7   135944   d1e2  e8e7  e2e3  e7e6  e3d4  h7h5  c2c4  h5h4 
+10&     34    7   135944   d1e2  e8e7  e2e3  e7e6  e3d4  h7h5  c2c4  h5h4 
                            d4e4  f7f5  e4f4 
 10.     34    9   173474   d1e2  e8e7  e2e3  e7e6  e3d4  h7h5  c2c4  h5h4 
                            d4e4  f7f5  e4f4 
@@ -1861,8 +2056,7 @@ means there are 30 seconds.  The final 0 means that we are in
 conventional clock mode.
 

-

- +

Note that the time parameter in this command is not a pure numeric argument, but in general is a character string, in order to pass the number of seconds. Engines are encouraged to ignore any unexpected characters at the end of this string, @@ -1876,7 +2070,6 @@ rather than another 25 minutes for the next 40 moves. When the time comes, (i.e. after the 40 moves), it will be informed of the time-control change by receiving a new "level 0 5 0" command, but engines with advanced time management might want to plan for this in advance. -

@@ -1903,7 +2096,7 @@ can go negative and then become positive again because of the increment.)

-

+

The number of moves given in the level command (when non-zero) should be taken as the number of moves still to do before the specified time will be added to the clock, if the "level" command is received after @@ -1922,7 +2115,7 @@ and the engine receives "level 20 22 0" just before move 41, it should understand that it should do the next 20 moves in 22 minutes (pehaps because the secondary session was 20 moves per 15 minutes, and it had 7 minutes left on its clock after the first 40 moves). -

+

A special rule on some ICS implementations: if you ask for a game with @@ -1959,11 +2152,11 @@ on one move does not accumulate for use on later moves. from files. However, all of these look the same from the chess engine's perspective. Basically, the engine just has to respond to the "analyze" command. - + Beginning in protocol version 2, if your engine does not support analyze mode, it should use the feature command to set analyze=0. - + The older method of printing the error message "Error (unknown command): analyze" in response to the "analyze" command will also work, however. @@ -1978,19 +2171,18 @@ following commands while in analyze mode:

@@ -2004,19 +2196,18 @@ The chess engine should respond to ".\n" with a line like this:

-stat01: time nodes ply mvleft mvtot mvname
+stat01: time nodes ply mvleft mvtot mvname
 
-Where: +

Where:

- + + + + +
timeElapsed search time in centiseconds (ie: 567 = 5.67 seconds). -
nodesNodes searched so far. -
plySearch depth so far. -
mvleftNumber of moves left to consider at this depth. -
mvtotTotal number of moves to consider. -
mvname -Move currently being considered (SAN or coordinate notation). Optional; -added in protocol version 2. +
timeElapsed search time in centiseconds (ie: 567 = 5.67 seconds).
nodesNodes searched so far.
plySearch depth so far.
mvleftNumber of moves left to consider at this depth.
mvtotTotal number of moves to consider.
mvnameMove currently being considered (SAN or coordinate notation). Optional; +added in protocol version 2.

@@ -2066,70 +2257,69 @@ that new engines set the feature colors=0 and/or ignore the commands.

-
time N -
otim N -
MOVE +
time N
+
otim N
+
MOVE
Sent when the opponent makes a move and the engine is already playing the opposite color. -

- -

white -
go + +
white
+
go
Sent when the engine is in force mode or playing Black but should switch to playing White. This sequence is sent only when White is already on move. - + If you set the feature colors=0, "white" is not sent. - -

+ +

-
black -
go +
black
+
go
Sent when the engine is in force mode or playing White but should switch to playing Black. This sequence is sent only when Black is already on move. - + If you set the feature colors=0, "black" is not sent. - -

- -

white -
time N -
otim N -
black -
go + + + +
white
+
time N
+
otim N
+
black
+
go
Sent when Black is on move, the engine is in force mode or playing White, and the engine's clock needs to be updated before it starts playing. The initial "white" is a kludge to accommodate GNU Chess 4's variant interpretation of these commands. - + If you set the feature colors=0, "white" and "black" are not sent. - -

- -

black -
time N -
otim N -
white -
go + + + +
black
+
time N
+
otim N
+
white
+
go
Sent when White is on move, the engine is in force mode or playing Black, and the engine's clock needs to be updated before it starts playing. See previous idiom. The initial "black" is a kludge to accommodate GNU Chess 4's variant interpretation of these commands. - + If you set the feature colors=0, "black" and "white" are not sent. - -

+ +

-
hard -
easy +
hard
+
easy
Sent in sequence to turn off pondering if xboard is not sure whether it is on. When xboard is sure, it will send "hard" or "easy" alone. xboard does this because "easy" is a toggle in GNU Chess 4 but "hard" is an absolute on. - +

@@ -2141,17 +2331,17 @@ code commands or the resign command instead.

- + + + + + + + + + +
Command Interpreted as -
White resigns 0-1 {White resigns} -
Black resigns 1-0 {Black resigns} -
White 1-0 {White mates} -
Black 0-1 {Black mates} -
Draw 1/2-1/2 {Draw} -
computer mates 1-0 {White mates} or 0-1 {Black mates} -
opponent mates 1-0 {White mates} or 0-1 {Black mates} -
computer resigns 0-1 {White resigns} or 1-0 {Black resigns} -
game is a draw 1/2-1/2 {Draw} -
checkmate 1-0 {White mates} or 0-1 {Black mates} +
Command Interpreted as
White resigns 0-1 {White resigns}
Black resigns 1-0 {Black resigns}
White 1-0 {White mates}
Black 0-1 {Black mates}
Draw 1/2-1/2 {Draw}
computer mates 1-0 {White mates} or 0-1 {Black mates}
opponent mates 1-0 {White mates} or 0-1 {Black mates}
computer resigns 0-1 {White resigns} or 1-0 {Black resigns}
game is a draw 1/2-1/2 {Draw}
checkmate 1-0 {White mates} or 0-1 {Black mates}

@@ -2167,8 +2357,8 @@ An alternative move syntax is also recognized:

- +
Command Interpreted as -
NUMBER ... MOVE move MOVE +
Command Interpreted as
NUMBER ... MOVE move MOVE

@@ -2204,19 +2394,16 @@ commands "tellall", "tellothers", "tellopponent", "tellics" (if needed), "1/2-1/2 {COMMENT}", or "offer draw", as appropriate.

-

- +

If the engine responds to the "sd DEPTH" command with an error message indicating the command is not supported (such as "Illegal move: sd"), xboard sets an internal flag and subsequently uses the command "depth\nDEPTH" instead, for the benefit of GNU Chess 4. Note the newline in the middle of this command! New engines should not rely on this feature. -

-

- +

If the engine responds to the "st TIME" command with an error message indicating the command is not supported (such as "Illegal move: st"), xboard sets an internal flag and subsequently uses the command "level @@ -2225,10 +2412,9 @@ not a standard use of the level command, as TIME seconds are not added after each player makes 1 move; rather, each move is made in at most TIME seconds. New engines should not implement or rely on this feature. -

- +

In support of the -firstHost/-secondHost features, which allow a chess engine to be run on another machine using the rsh protocol, xboard recognizes @@ -2236,18 +2422,17 @@ error messages that are likely to come from rsh as fatal errors. The following messages are currently recognized:

-
-unknown host
-No remote directory
-not found
-No such file
-can't alloc
-Permission denied
-
-
+
    +
  • unknown host
  • +
  • No remote directory
  • +
  • not found
  • +
  • No such file
  • +
  • can't alloc
  • +
  • Permission denied
  • +
+
-

- +

ChessBase/Fritz now implements the xboard/winboard protocol and can use WinBoard-compatible engines in its GUI. ChessBase's version of the protocol is generally the same as version 1, except that they have @@ -2259,21 +2444,16 @@ implement these additional commands, and you should also be aware of the peculiar way that ChessBase uses the protocol. See their web page for documentation. -

-

- +

ChessMaster 8000 also implements version 1 of the xboard/winboard protocol and can use WinBoard-compatible engines. The original release of CM8000 also has one additional restriction: only pure coordinate notation (e.g., e2e4) is accepted in the move command. A patch to correct this should be available from The Learning Company (makers of CM8000) in February 2001. -

-
-
converted to HTML by Steffen A. Jakob