UCI Protocol

Stockfish uses the UCI protocol to communicate with a GUI. A nice overview of this protocol is available at Wikipedia.

The actual documentation is available for download at: http://download.shredderchess.com/div/uci.zip

An abridged summary of notable UCI commands follows. This is useful if you are running Stockfish from the command line.

Setting the position

position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

This sets the position with a FEN string. As always, Wikipedia has an overview of this notation.

position startpos moves e2e4

This sets the position with moves starting from the starting position. This notation is preferred because the engine can take into account such things as the 50-move rule or threefold repetition.

Changing settings

uci

This outputs the list of settings.

setoption name Hash value 1024

This sets the hash size to 1 GB.

setoption name Threads value 4

This asks Stockfish to use 4 threads when analyzing.

Analyzing

go infinite

Asks the engine to analyze forever. Send the stop command to stop analysis or press CTRL + C to quit..

go depth 20

Asks the engine to analyze to a specific depth.

go movetime 5000

Asks the engine to analyze for 5 seconds.