1

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 2

1

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.

3
  • 2
    FEN 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.
    – causaSui
    Commented 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
2

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.

2
  • But why is that preferable? Commented Oct 28, 2020 at 16:05
  • @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.