UCI Protocol
quit
Quits the engine. The engine exits immediately after receiving it. The engine outputs nothing.
ucinewgame
When starting a new game, the GUI should send the ucinewgame command to the engine to clear the hash table and so on. Executing ucinewgame may take some time, so after sending it the GUI should use isready to confirm the engine's state.
setoption
Sets an engine option. Usage:
setoption name <id> [value <x>]Here <id> is the UCI option name and <x> is the value you want to set.
For example, for a GUI to set the engine's thread count to 16, it can send:
setoption name Threads value 16Some options, such as Clear Hash (clear the hash table), can omit value and be used directly, for example:
setoption name Clear HashFor UCI options, see the "UCI Options" page; they are not repeated here.
The engine outputs nothing.
isready
Used to check whether the engine is working properly. The engine should always output readyok.
uci
Used to get information about the engine (such as its name, author, UCI options, etc.). Example output:
id name Pikafish 2024-02-18
id author the Pikafish developers (see AUTHORS file)
option name Debug Log File type string default
option name Threads type spin default 1 min 1 max 1024
option name Hash type spin default 16 min 1 max 33554432
option name Clear Hash type button
option name Ponder type check default false
option name MultiPV type spin default 1 min 1 max 128
...
uciokuciok is required. If, after the GUI sends uci, it does not receive uciok from the engine, the GUI will consider the program not to be a UCI engine.
[position] fen
Gives the engine a position as a FEN.
For example:
position fen 3k1a3/4a4/5n3/9/9/9/9/9/9/4KR3 wOr add a movelist (the move history) on top of that:
5a3/3ka4/5n3/9/9/9/9/9/9/4K1R2 w - - 0 1 moves g0f0 d8d9Note
Xiangqi engines use UCI-Cyclone, where position can be omitted, and rank numbers start from 0.
The engine outputs nothing.
[position] startpos
Sets the current position to the starting position (rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR w). position can be omitted.
The engine outputs nothing.
go
Makes the engine analyze the current position (which can be set with the position command).
The following parameters can be added:
searchmoves <move1> <move2> ... <movei>: restricts the search to the specified moves (the GUI's "alternative move" feature needs this parameter). Note that the UCI protocol has nobanmovescommand (that one is from the UCCI protocol).infinite: analyze without limit (untilstopis sent).ponder: think in the background.wtime,btime: the time remaining for Red and Black (ms).winc,binc: the increment for Red and Black (ms).movestogo: for "so much time for so many moves" time controls; tells the engine how many moves remain until new time is granted. It is generally not used in Xiangqi.depth: search to the specified depth.nodes: search the specified number of nodes.mate: search for a mate in the specified number of moves, and stop once found.movetime: the specified time per move (ms).perft: enumerate the positions reachable within the given number of plies.
After go is entered, the engine searches the current position and outputs the search results. The engine stops searching when the corresponding limit is reached or the user sends the stop command.
d
Outputs the current position, its FEN, key information and check information. This command is for engine development and debugging.
eval
Outputs evaluation information for the current position. This command is for engine development and debugging.
export_net
Exports the network weights. A file name can be specified.
flip
Switches the side to move.
compiler
Outputs information about the compiler and the engine's instruction set.
