Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 40 | pmbaty | 1 | |
| 2 | |||
| 3 | Description of the universal chess interface (UCI) April 2006 | ||
| 4 | ================================================================= | ||
| 5 | |||
| 6 | * The specification is independent of the operating system. For Windows, | ||
| 7 | the engine is a normal exe file, either a console or "real" windows application. | ||
| 8 | |||
| 9 | * all communication is done via standard input and output with text commands, | ||
| 10 | |||
| 11 | * The engine should boot and wait for input from the GUI, | ||
| 12 | the engine should wait for the "isready" or "setoption" command to set up its internal parameters | ||
| 13 | as the boot process should be as quick as possible. | ||
| 14 | |||
| 15 | * the engine must always be able to process input from stdin, even while thinking. | ||
| 16 | |||
| 17 | * all command strings the engine receives will end with '\n', | ||
| 18 | also all commands the GUI receives should end with '\n', | ||
| 19 | Note: '\n' can be 0x0d or 0x0a0d or any combination depending on your OS. | ||
| 20 | If you use Engine and GUI in the same OS this should be no problem if you communicate in text mode, | ||
| 21 | but be aware of this when for example running a Linux engine in a Windows GUI. | ||
| 22 | |||
| 23 | * arbitrary white space between tokens is allowed | ||
| 24 | Example: "debug on\n" and " debug on \n" and "\t debug \t \t\ton\t \n" | ||
| 25 | all set the debug mode of the engine on. | ||
| 26 | |||
| 27 | * The engine will always be in forced mode which means it should never start calculating | ||
| 28 | or pondering without receiving a "go" command first. | ||
| 29 | |||
| 30 | * Before the engine is asked to search on a position, there will always be a position command | ||
| 31 | to tell the engine about the current position. | ||
| 32 | |||
| 33 | * by default all the opening book handling is done by the GUI, | ||
| 34 |   but there is an option for the engine to use its own book ("OwnBook" option, see below) | ||
| 35 | |||
| 36 | * if the engine or the GUI receives an unknown command or token it should just ignore it and try to | ||
| 37 | parse the rest of the string in this line. | ||
| 38 | Examples: "joho debug on\n" should switch the debug mode on given that joho is not defined, | ||
| 39 | "debug joho on\n" will be undefined however. | ||
| 40 | |||
| 41 | * if the engine receives a command which is not supposed to come, for example "stop" when the engine is | ||
| 42 | not calculating, it should also just ignore it. | ||
| 43 | |||
| 44 | |||
| 45 | Move format: | ||
| 46 | ------------ | ||
| 47 | |||
| 48 | The move format is in long algebraic notation. | ||
| 49 | A nullmove from the Engine to the GUI should be sent as 0000. | ||
| 50 | Examples: e2e4, e7e5, e1g1 (white short castling), e7e8q (for promotion) | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | GUI to engine: | ||
| 55 | -------------- | ||
| 56 | |||
| 57 | These are all the command the engine gets from the interface. | ||
| 58 | |||
| 59 | * uci | ||
| 60 | tell engine to use the uci (universal chess interface), | ||
| 61 | this will be sent once as a first command after program boot | ||
| 62 | to tell the engine to switch to uci mode. | ||
| 63 | After receiving the uci command the engine must identify itself with the "id" command | ||
| 64 | and send the "option" commands to tell the GUI which engine settings the engine supports if any. | ||
| 65 | After that the engine should send "uciok" to acknowledge the uci mode. | ||
| 66 | If no uciok is sent within a certain time period, the engine task will be killed by the GUI. | ||
| 67 | |||
| 68 | * debug [ on | off ] | ||
| 69 | switch the debug mode of the engine on and off. | ||
| 70 | In debug mode the engine should send additional infos to the GUI, e.g. with the "info string" command, | ||
| 71 | to help debugging, e.g. the commands that the engine has received etc. | ||
| 72 | This mode should be switched off by default and this command can be sent | ||
| 73 | any time, also when the engine is thinking. | ||
| 74 | |||
| 75 | * isready | ||
| 76 | this is used to synchronize the engine with the GUI. When the GUI has sent a command or | ||
| 77 | multiple commands that can take some time to complete, | ||
| 78 | this command can be used to wait for the engine to be ready again or | ||
| 79 | to ping the engine to find out if it is still alive. | ||
| 80 | E.g. this should be sent after setting the path to the tablebases as this can take some time. | ||
| 81 | This command is also required once before the engine is asked to do any search | ||
| 82 | to wait for the engine to finish initializing. | ||
| 83 | This command must always be answered with "readyok" and can be sent also when the engine is calculating | ||
| 84 | in which case the engine should also immediately answer with "readyok" without stopping the search. | ||
| 85 | |||
| 86 | * setoption name <id> [value <x>] | ||
| 87 | this is sent to the engine when the user wants to change the internal parameters | ||
| 88 | of the engine. For the "button" type no value is needed. | ||
| 89 | One string will be sent for each parameter and this will only be sent when the engine is waiting. | ||
| 90 | The name and value of the option in <id> should not be case sensitive and can inlude spaces. | ||
| 91 | The substrings "value" and "name" should be avoided in <id> and <x> to allow unambiguous parsing, | ||
| 92 | for example do not use <name> = "draw value". | ||
| 93 | Here are some strings for the example below: | ||
| 94 | "setoption name Nullmove value true\n" | ||
| 95 | "setoption name Selectivity value 3\n" | ||
| 96 | "setoption name Style value Risky\n" | ||
| 97 | "setoption name Clear Hash\n" | ||
| 98 | "setoption name NalimovPath value c:\chess\tb\4;c:\chess\tb\5\n" | ||
| 99 | |||
| 100 | * ucinewgame | ||
| 101 | this is sent to the engine when the next search (started with "position" and "go") will be from | ||
| 102 | a different game. This can be a new game the engine should play or a new game it should analyse but | ||
| 103 | also the next position from a testsuite with positions only. | ||
| 104 | If the GUI hasn't sent a "ucinewgame" before the first "position" command, the engine shouldn't | ||
| 105 | expect any further ucinewgame commands as the GUI is probably not supporting the ucinewgame command. | ||
| 106 | So the engine should not rely on this command even though all new GUIs should support it. | ||
| 107 | As the engine's reaction to "ucinewgame" can take some time the GUI should always send "isready" | ||
| 108 | after "ucinewgame" to wait for the engine to finish its operation. | ||
| 109 | |||
| 110 | * position [fen <fenstring> | startpos ] moves <move1> .... <movei> | ||
| 111 | set up the position described in fenstring on the internal board and | ||
| 112 | play the moves on the internal chess board. | ||
| 113 | if the game was played from the start position the string "startpos" will be sent | ||
| 114 | Note: no "new" command is needed. However, if this position is from a different game than | ||
| 115 | the last position sent to the engine, the GUI should have sent a "ucinewgame" inbetween. | ||
| 116 | |||
| 117 | * go | ||
| 118 | start calculating on the current position set up with the "position" command. | ||
| 119 | There are a number of commands that can follow this command, all will be sent in the same string. | ||
| 120 | If one command is not sent its value should be interpreted as it would not influence the search. | ||
| 121 | * searchmoves <move1> .... <movei> | ||
| 122 | restrict search to this moves only | ||
| 123 | Example: After "position startpos" and "go infinite searchmoves e2e4 d2d4" | ||
| 124 | the engine should only search the two moves e2e4 and d2d4 in the initial position. | ||
| 125 | * ponder | ||
| 126 | start searching in pondering mode. | ||
| 127 | Do not exit the search in ponder mode, even if it's mate! | ||
| 128 | This means that the last move sent in in the position string is the ponder move. | ||
| 129 | The engine can do what it wants to do, but after a "ponderhit" command | ||
| 130 | it should execute the suggested move to ponder on. This means that the ponder move sent by | ||
| 131 | the GUI can be interpreted as a recommendation about which move to ponder. However, if the | ||
| 132 | engine decides to ponder on a different move, it should not display any mainlines as they are | ||
| 133 | likely to be misinterpreted by the GUI because the GUI expects the engine to ponder | ||
| 134 | on the suggested move. | ||
| 135 | * wtime <x> | ||
| 136 | white has x msec left on the clock | ||
| 137 | * btime <x> | ||
| 138 | black has x msec left on the clock | ||
| 139 | * winc <x> | ||
| 140 | white increment per move in mseconds if x > 0 | ||
| 141 | * binc <x> | ||
| 142 | black increment per move in mseconds if x > 0 | ||
| 143 | * movestogo <x> | ||
| 144 | there are x moves to the next time control, | ||
| 145 | this will only be sent if x > 0, | ||
| 146 | if you don't get this and get the wtime and btime it's sudden death | ||
| 147 | * depth <x> | ||
| 148 | search x plies only. | ||
| 149 | * nodes <x> | ||
| 150 | search x nodes only, | ||
| 151 | * mate <x> | ||
| 152 | search for a mate in x moves | ||
| 153 | * movetime <x> | ||
| 154 | search exactly x mseconds | ||
| 155 | * infinite | ||
| 156 | search until the "stop" command. Do not exit the search without being told so in this mode! | ||
| 157 | |||
| 158 | * stop | ||
| 159 | stop calculating as soon as possible, | ||
| 160 | don't forget the "bestmove" and possibly the "ponder" token when finishing the search | ||
| 161 | |||
| 162 | * ponderhit | ||
| 163 | the user has played the expected move. This will be sent if the engine was told to ponder on the same move | ||
| 164 | the user has played. The engine should continue searching but switch from pondering to normal search. | ||
| 165 | |||
| 166 | * quit | ||
| 167 | quit the program as soon as possible | ||
| 168 | |||
| 169 | |||
| 170 | Engine to GUI: | ||
| 171 | -------------- | ||
| 172 | |||
| 173 | * id | ||
| 174 | * name <x> | ||
| 175 | this must be sent after receiving the "uci" command to identify the engine, | ||
| 176 | e.g. "id name Shredder X.Y\n" | ||
| 177 | * author <x> | ||
| 178 | this must be sent after receiving the "uci" command to identify the engine, | ||
| 179 | e.g. "id author Stefan MK\n" | ||
| 180 | |||
| 181 | * uciok | ||
| 182 | Must be sent after the id and optional options to tell the GUI that the engine | ||
| 183 | has sent all infos and is ready in uci mode. | ||
| 184 | |||
| 185 | * readyok | ||
| 186 | This must be sent when the engine has received an "isready" command and has | ||
| 187 | processed all input and is ready to accept new commands now. | ||
| 188 | It is usually sent after a command that can take some time to be able to wait for the engine, | ||
| 189 | but it can be used anytime, even when the engine is searching, | ||
| 190 | and must always be answered with "isready". | ||
| 191 | |||
| 192 | * bestmove <move1> [ ponder <move2> ] | ||
| 193 | the engine has stopped searching and found the move <move> best in this position. | ||
| 194 | the engine can send the move it likes to ponder on. The engine must not start pondering automatically. | ||
| 195 | this command must always be sent if the engine stops searching, also in pondering mode if there is a | ||
| 196 | "stop" command, so for every "go" command a "bestmove" command is needed! | ||
| 197 | Directly before that the engine should send a final "info" command with the final search information, | ||
| 198 | the the GUI has the complete statistics about the last search. | ||
| 199 | |||
| 200 | * info | ||
| 201 | the engine wants to send information to the GUI. This should be done whenever one of the info has changed. | ||
| 202 | The engine can send only selected infos or multiple infos with one info command, | ||
| 203 | e.g. "info currmove e2e4 currmovenumber 1" or | ||
| 204 | "info depth 12 nodes 123456 nps 100000". | ||
| 205 | Also all infos belonging to the pv should be sent together | ||
| 206 | e.g. "info depth 2 score cp 214 time 1242 nodes 2124 nps 34928 pv e2e4 e7e5 g1f3" | ||
| 207 | I suggest to start sending "currmove", "currmovenumber", "currline" and "refutation" only after one second | ||
| 208 | to avoid too much traffic. | ||
| 209 | Additional info: | ||
| 210 | * depth <x> | ||
| 211 | search depth in plies | ||
| 212 | * seldepth <x> | ||
| 213 | selective search depth in plies, | ||
| 214 | if the engine sends seldepth there must also be a "depth" present in the same string. | ||
| 215 | * time <x> | ||
| 216 | the time searched in ms, this should be sent together with the pv. | ||
| 217 | * nodes <x> | ||
| 218 | x nodes searched, the engine should send this info regularly | ||
| 219 | * pv <move1> ... <movei> | ||
| 220 | the best line found | ||
| 221 | * multipv <num> | ||
| 222 | this for the multi pv mode. | ||
| 223 | for the best move/pv add "multipv 1" in the string when you send the pv. | ||
| 224 | in k-best mode always send all k variants in k strings together. | ||
| 225 | * score | ||
| 226 | * cp <x> | ||
| 227 | the score from the engine's point of view in centipawns. | ||
| 228 | * mate <y> | ||
| 229 | mate in y moves, not plies. | ||
| 230 | If the engine is getting mated use negative values for y. | ||
| 231 | * lowerbound | ||
| 232 | the score is just a lower bound. | ||
| 233 | * upperbound | ||
| 234 | the score is just an upper bound. | ||
| 235 | * currmove <move> | ||
| 236 | currently searching this move | ||
| 237 | * currmovenumber <x> | ||
| 238 | currently searching move number x, for the first move x should be 1 not 0. | ||
| 239 | * hashfull <x> | ||
| 240 | the hash is x permill full, the engine should send this info regularly | ||
| 241 | * nps <x> | ||
| 242 | x nodes per second searched, the engine should send this info regularly | ||
| 243 | * tbhits <x> | ||
| 244 | x positions where found in the endgame table bases | ||
| 245 | * sbhits <x> | ||
| 246 | x positions where found in the shredder endgame databases | ||
| 247 | * cpuload <x> | ||
| 248 | the cpu usage of the engine is x permill. | ||
| 249 | * string <str> | ||
| 250 | any string str which will be displayed be the engine, | ||
| 251 | if there is a string command the rest of the line will be interpreted as <str>. | ||
| 252 | * refutation <move1> <move2> ... <movei> | ||
| 253 | move <move1> is refuted by the line <move2> ... <movei>, i can be any number >= 1. | ||
| 254 | Example: after move d1h5 is searched, the engine can send | ||
| 255 | "info refutation d1h5 g6h5" | ||
| 256 | if g6h5 is the best answer after d1h5 or if g6h5 refutes the move d1h5. | ||
| 257 | if there is no refutation for d1h5 found, the engine should just send | ||
| 258 | "info refutation d1h5" | ||
| 259 | The engine should only send this if the option "UCI_ShowRefutations" is set to true. | ||
| 260 | * currline <cpunr> <move1> ... <movei> | ||
| 261 | this is the current line the engine is calculating. <cpunr> is the number of the cpu if | ||
| 262 | the engine is running on more than one cpu. <cpunr> = 1,2,3.... | ||
| 263 | if the engine is just using one cpu, <cpunr> can be omitted. | ||
| 264 | If <cpunr> is greater than 1, always send all k lines in k strings together. | ||
| 265 | The engine should only send this if the option "UCI_ShowCurrLine" is set to true. | ||
| 266 | |||
| 267 | |||
| 268 | * option | ||
| 269 | This command tells the GUI which parameters can be changed in the engine. | ||
| 270 | This should be sent once at engine startup after the "uci" and the "id" commands | ||
| 271 | if any parameter can be changed in the engine. | ||
| 272 | The GUI should parse this and build a dialog for the user to change the settings. | ||
| 273 | Note that not every option needs to appear in this dialog as some options like | ||
| 274 | "Ponder", "UCI_AnalyseMode", etc. are better handled elsewhere or are set automatically. | ||
| 275 | If the user wants to change some settings, the GUI will send a "setoption" command to the engine. | ||
| 276 | Note that the GUI need not send the setoption command when starting the engine for every option if | ||
| 277 | it doesn't want to change the default value. | ||
| 278 | For all allowed combinations see the examples below, | ||
| 279 | as some combinations of this tokens don't make sense. | ||
| 280 | One string will be sent for each parameter. | ||
| 281 | * name <id> | ||
| 282 | The option has the name id. | ||
| 283 | Certain options have a fixed value for <id>, which means that the semantics of this option is fixed. | ||
| 284 | Usually those options should not be displayed in the normal engine options window of the GUI but | ||
| 285 | get a special treatment. "Pondering" for example should be set automatically when pondering is | ||
| 286 | enabled or disabled in the GUI options. The same for "UCI_AnalyseMode" which should also be set | ||
| 287 | automatically by the GUI. All those certain options have the prefix "UCI_" except for the | ||
| 288 | first 6 options below. If the GUI gets an unknown Option with the prefix "UCI_", it should just | ||
| 289 | ignore it and not display it in the engine's options dialog. | ||
| 290 | * <id> = Hash, type is spin | ||
| 291 | the value in MB for memory for hash tables can be changed, | ||
| 292 | this should be answered with the first "setoptions" command at program boot | ||
| 293 | if the engine has sent the appropriate "option name Hash" command, | ||
| 294 | which should be supported by all engines! | ||
| 295 | So the engine should use a very small hash first as default. | ||
| 296 | * <id> = NalimovPath, type string | ||
| 297 | this is the path on the hard disk to the Nalimov compressed format. | ||
| 298 | Multiple directories can be concatenated with ";" | ||
| 299 | * <id> = NalimovCache, type spin | ||
| 300 | this is the size in MB for the cache for the nalimov table bases | ||
| 301 | These last two options should also be present in the initial options exchange dialog | ||
| 302 | when the engine is booted if the engine supports it | ||
| 303 | * <id> = Ponder, type check | ||
| 304 | this means that the engine is able to ponder. | ||
| 305 | The GUI will send this whenever pondering is possible or not. | ||
| 306 | Note: The engine should not start pondering on its own if this is enabled, this option is only | ||
| 307 | needed because the engine might change its time management algorithm when pondering is allowed. | ||
| 308 | * <id> = OwnBook, type check | ||
| 309 | this means that the engine has its own book which is accessed by the engine itself. | ||
| 310 | if this is set, the engine takes care of the opening book and the GUI will never | ||
| 311 | execute a move out of its book for the engine. If this is set to false by the GUI, | ||
| 312 | the engine should not access its own book. | ||
| 313 | * <id> = MultiPV, type spin | ||
| 314 | the engine supports multi best line or k-best mode. the default value is 1 | ||
| 315 | * <id> = UCI_ShowCurrLine, type check, should be false by default, | ||
| 316 | the engine can show the current line it is calculating. see "info currline" above. | ||
| 317 | * <id> = UCI_ShowRefutations, type check, should be false by default, | ||
| 318 | the engine can show a move and its refutation in a line. see "info refutations" above. | ||
| 319 | * <id> = UCI_LimitStrength, type check, should be false by default, | ||
| 320 | The engine is able to limit its strength to a specific Elo number, | ||
| 321 | This should always be implemented together with "UCI_Elo". | ||
| 322 | * <id> = UCI_Elo, type spin | ||
| 323 | The engine can limit its strength in Elo within this interval. | ||
| 324 | If UCI_LimitStrength is set to false, this value should be ignored. | ||
| 325 | If UCI_LimitStrength is set to true, the engine should play with this specific strength. | ||
| 326 | This should always be implemented together with "UCI_LimitStrength". | ||
| 327 | * <id> = UCI_AnalyseMode, type check | ||
| 328 | The engine wants to behave differently when analysing or playing a game. | ||
| 329 | For example when playing it can use some kind of learning. | ||
| 330 | This is set to false if the engine is playing a game, otherwise it is true. | ||
| 331 | * <id> = UCI_Opponent, type string | ||
| 332 | With this command the GUI can send the name, title, elo and if the engine is playing a human | ||
| 333 | or computer to the engine. | ||
| 334 | The format of the string has to be [GM|IM|FM|WGM|WIM|none] [<elo>|none] [computer|human] <name> | ||
| 335 | Examples: | ||
| 336 | "setoption name UCI_Opponent value GM 2800 human Gary Kasparov" | ||
| 337 | "setoption name UCI_Opponent value none none computer Shredder" | ||
| 338 | * <id> = UCI_EngineAbout, type string | ||
| 339 | With this command, the engine tells the GUI information about itself, for example a license text, | ||
| 340 | usually it doesn't make sense that the GUI changes this text with the setoption command. | ||
| 341 | Example: | ||
| 342 | "option name UCI_EngineAbout type string default Shredder by Stefan Meyer-Kahlen, see www.shredderchess.com" | ||
| 343 | * <id> = UCI_ShredderbasesPath, type string | ||
| 344 | this is either the path to the folder on the hard disk containing the Shredder endgame databases or | ||
| 345 | the path and filename of one Shredder endgame datbase. | ||
| 346 | * <id> = UCI_SetPositionValue, type string | ||
| 347 | the GUI can send this to the engine to tell the engine to use a certain value in centipawns from white's | ||
| 348 | point of view if evaluating this specifix position. | ||
| 349 | The string can have the formats: | ||
| 350 | <value> + <fen> | clear + <fen> | clearall | ||
| 351 | |||
| 352 | * type <t> | ||
| 353 | The option has type t. | ||
| 354 | There are 5 different types of options the engine can send | ||
| 355 | * check | ||
| 356 | a checkbox that can either be true or false | ||
| 357 | * spin | ||
| 358 | a spin wheel that can be an integer in a certain range | ||
| 359 | * combo | ||
| 360 | a combo box that can have different predefined strings as a value | ||
| 361 | * button | ||
| 362 | a button that can be pressed to send a command to the engine | ||
| 363 | * string | ||
| 364 | a text field that has a string as a value, | ||
| 365 | an empty string has the value "<empty>" | ||
| 366 | * default <x> | ||
| 367 | the default value of this parameter is x | ||
| 368 | * min <x> | ||
| 369 | the minimum value of this parameter is x | ||
| 370 | * max <x> | ||
| 371 | the maximum value of this parameter is x | ||
| 372 | * var <x> | ||
| 373 | a predefined value of this parameter is x | ||
| 374 | Examples: | ||
| 375 | Here are 5 strings for each of the 5 possible types of options | ||
| 376 | "option name Nullmove type check default true\n" | ||
| 377 | "option name Selectivity type spin default 2 min 0 max 4\n" | ||
| 378 | "option name Style type combo default Normal var Solid var Normal var Risky\n" | ||
| 379 | "option name NalimovPath type string default c:\\n" | ||
| 380 | "option name Clear Hash type button\n" | ||
| 381 | |||
| 382 | |||
| 383 | |||
| 384 | Examples: | ||
| 385 | --------- | ||
| 386 | |||
| 387 | This is how the communication when the engine boots can look like: | ||
| 388 | |||
| 389 | GUI engine | ||
| 390 | |||
| 391 | // tell the engine to switch to UCI mode | ||
| 392 | uci | ||
| 393 | |||
| 394 | // engine identify | ||
| 395 | id name Shredder | ||
| 396 | id author Stefan MK | ||
| 397 | |||
| 398 | // engine sends the options it can change | ||
| 399 | // the engine can change the hash size from 1 to 128 MB | ||
| 400 | option name Hash type spin default 1 min 1 max 128 | ||
| 401 | |||
| 402 | // the engine supports Nalimov endgame tablebases | ||
| 403 | option name NalimovPath type string default <empty> | ||
| 404 | option name NalimovCache type spin default 1 min 1 max 32 | ||
| 405 | |||
| 406 | // the engine can switch off Nullmove and set the playing style | ||
| 407 | option name Nullmove type check default true | ||
| 408 | option name Style type combo default Normal var Solid var Normal var Risky | ||
| 409 | |||
| 410 | // the engine has sent all parameters and is ready | ||
| 411 | uciok | ||
| 412 | |||
| 413 | // Note: here the GUI can already send a "quit" command if it just wants to find out | ||
| 414 | // details about the engine, so the engine should not initialize its internal | ||
| 415 | // parameters before here. | ||
| 416 | // now the GUI sets some values in the engine | ||
| 417 | // set hash to 32 MB | ||
| 418 | setoption name Hash value 32 | ||
| 419 | |||
| 420 | // init tbs | ||
| 421 | setoption name NalimovCache value 1 | ||
| 422 | setoption name NalimovPath value d:\tb;c\tb | ||
| 423 | |||
| 424 | // waiting for the engine to finish initializing | ||
| 425 | // this command and the answer is required here! | ||
| 426 | isready | ||
| 427 | |||
| 428 | // engine has finished setting up the internal values | ||
| 429 | readyok | ||
| 430 | |||
| 431 | // now we are ready to go | ||
| 432 | |||
| 433 | // if the GUI is supporting it, tell the engine that is is | ||
| 434 | // searching on a game that it hasn't searched on before | ||
| 435 | ucinewgame | ||
| 436 | |||
| 437 | // if the engine supports the "UCI_AnalyseMode" option and the next search is supposed to | ||
| 438 | // be an analysis, the GUI should set "UCI_AnalyseMode" to true if it is currently | ||
| 439 | // set to false with this engine | ||
| 440 | setoption name UCI_AnalyseMode value true | ||
| 441 | |||
| 442 | // tell the engine to search infinite from the start position after 1.e4 e5 | ||
| 443 | position startpos moves e2e4 e7e5 | ||
| 444 | go infinite | ||
| 445 | |||
| 446 | // the engine starts sending infos about the search to the GUI | ||
| 447 | // (only some examples are given) | ||
| 448 | |||
| 449 | |||
| 450 | info depth 1 seldepth 0 | ||
| 451 | info score cp 13 depth 1 nodes 13 time 15 pv f1b5 | ||
| 452 | info depth 2 seldepth 2 | ||
| 453 | info nps 15937 | ||
| 454 | info score cp 14 depth 2 nodes 255 time 15 pv f1c4 f8c5 | ||
| 455 | info depth 2 seldepth 7 nodes 255 | ||
| 456 | info depth 3 seldepth 7 | ||
| 457 | info nps 26437 | ||
| 458 | info score cp 20 depth 3 nodes 423 time 15 pv f1c4 g8f6 b1c3 | ||
| 459 | info nps 41562 | ||
| 460 | .... | ||
| 461 | |||
| 462 | |||
| 463 | // here the user has seen enough and asks to stop the searching | ||
| 464 | stop | ||
| 465 | |||
| 466 | // the engine has finished searching and is sending the bestmove command | ||
| 467 | // which is needed for every "go" command sent to tell the GUI | ||
| 468 | // that the engine is ready again | ||
| 469 | bestmove g1f3 ponder d8f6 | ||
| 470 | |||
| 471 | |||
| 472 | |||
| 473 | Chess960 | ||
| 474 | ======== | ||
| 475 | |||
| 476 | UCI could easily be extended to support Chess960 (also known as Fischer Random Chess). | ||
| 477 | |||
| 478 | The engine has to tell the GUI that it is capable of playing Chess960 and the GUI has to tell | ||
| 479 | the engine that is should play according to the Chess960 rules. | ||
| 480 | This is done by the special engine option UCI_Chess960. If the engine knows about Chess960 | ||
| 481 | it should send the command 'option name UCI_Chess960 type check default false' | ||
| 482 | to the GUI at program startup. | ||
| 483 | Whenever a Chess960 game is played, the GUI should set this engine option to 'true'. | ||
| 484 | |||
| 485 | Castling is different in Chess960 and the white king move when castling short is not always e1g1. | ||
| 486 | A king move could both be the castling king move or just a normal king move. | ||
| 487 | This is why castling moves are sent in the form king "takes" his own rook. | ||
| 488 | Example: e1h1 for the white short castle move in the normal chess start position. | ||
| 489 | |||
| 490 | In EPD and FEN position strings specifying the castle rights with w and q is not enough as | ||
| 491 | there could be more than one rook on the right or left side of the king. | ||
| 492 | This is why the castle rights are specified with the letter of the castle rook's line. | ||
| 493 | Upper case letters for white's and lower case letters for black's castling rights. | ||
| 494 | Example: The normal chess position would be: | ||
| 495 | rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w AHah - | ||
| 496 |