Usage

How to run FollyChess and connect it to a chess GUI.

Once you have compiled the engine, you can use it through a chess GUI or directly on the command line.

Using with a chess GUI

FollyChess implements the Universal Chess Interface (UCI). It does not draw a board itself; a chess GUI does that and talks to the engine for you. Some GUIs that work well:

In your GUI, add a new engine and select the bazel-bin/cli/follychess binary when prompted.

Running on the command line

You can also talk to the engine directly via your shell. This is useful for debugging and scripting:

bazel-bin/cli/follychess

The engine then waits for commands. FollyChess supports a subset of the UCI protocol, described below. In the examples, commands you type are shown in bold; the rest is engine output.

uci

Starts the UCI protocol. The engine identifies itself and lists its options.

isready

Synchronizes with the engine. FollyChess answers readyok once it has finished its internal setup.

d

A custom command (not part of UCI). Prints the current position:

d
8: r n b q k b n r
7: p p p p p p p p
6: . . . . . . . .
5: . . . . . . . .
4: . . . . . . . .
3: . . . . . . . .
2: P P P P P P P P
1: R N B Q K B N R
   a b c d e f g h

   w KQkq - 0 1

position

Sets up the board. It supports these forms:

Starting position. position startpos resets the board to the starting position.

FEN string. position fen <fenstring> sets the board to a position given in Forsyth–Edwards Notation:

position fen 8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 1
d
8: . . . . . . . .
7: . . p . . . . .
6: . . . p . . . .
5: K P . . . . . r
4: . R . . . p . k
3: . . . . . . . .
2: . . . . P . P .
1: . . . . . . . .
   a b c d e f g h

   w - - 0 1

Adding moves. position [startpos | fen <fenstring>] moves <move1> <move2> ... applies a sequence of moves to the given position:

position startpos moves e2e4 e7e5 g1f3
d
8: r n b q k b n r
7: p p p p . p p p
6: . . . . . . . .
5: . . . . p . . .
4: . . . . P . . .
3: . . . . . N . .
2: P P P P . P P P
1: R N B Q K B . R
   a b c d e f g h

   b KQkq - 3 2

Moves use long algebraic notation:

TypeFormatExample
Standard<from><to> e2e4, g1f3
Castling<from><to> e1g1 (white kingside), e8c8 (black queenside)
Promotion<from><to><piece> a7a8q (queen), h2h1n (knight)

go

Calculates the best move at a given depth:

go depth 3
info depth 3 seldepth 3 nodes 1024 nps 175402 tbhits 36
info depth 3 seldepth 4 nodes 2048 nps 241766 tbhits 133
info depth 3 seldepth 3 nodes 3072 nps 286567 tbhits 166
info depth 3 seldepth 3 nodes 4096 nps 286033 tbhits 187
info depth 3 seldepth 3 nodes 5120 nps 310058 tbhits 264
bestmove b1c3

quit

Ends the engine process.