I am actually programming a chess UI and I'd like to communicate with a chess engine using UCI protocol. After reading the protocol specifications, I am not sure how to use the position command. For each move, is it better to pass to the chess engine a FEN notation of the actual state of the board or pass it the list of all moves that have been played since the beginning of the game?
2 Answers
If possible, it is better to send the whole game. The engine can use this to see that a move it is considering would lead to a draw by threefold repetition or the 50 move rule.
But sometimes you only have a position, and then sending a FEN is possible.
-
2FEN includes a halfmove clock (though you still need the full list for threefold repetition) Commented Oct 28, 2020 at 16:13
-
FEN does not have any way to notate available en-passant captures. The OP should send the list of moves as RemcoGerlich suggested.– causaSuiCommented Nov 5, 2020 at 0:24
-
1@causaSui: actually it does, the fourth field is the "en passant target square", or "-" if there is no en passant possible. Commented Nov 5, 2020 at 7:33
It is preferable to pass a PGN because FEN is just a position with no move, but a PGN is the whole game with moves.
-
-
@RemcoGerlich in theory an engine might be able to use the move history to aid reasoning - eg. if you've played aggressively so far, the engine might use a different strategy than if you've played a defensive game. In practice, I have no idea if any engines actually reason beyond the board state. Commented Oct 28, 2020 at 16:07