mvk wrote:I believe we can summarise the FIDE logic as follows: For repetition, castling RIGHTS and en-passant POSSIBILITIES are what matters.
For en passant it makes a lot of sense to look only at the availability of a legal en passant capturing move. Because how to define 'right' in this case? What if the pawn is pinned? What if there is no adjacent pawn after a double pawn push? Does there exist a 'right' in that case? Of course not (forget the old FEN stance here), but it is ugly, for a human, to define 'right' in any other way than as 'a legal e.p. capture exists'.
If you define 'en-passant right' in this non-ugly way as 'a legal e.p. capture exists', then the rule is: For repetition, castling rights and en-passant rights are what matters.
But I don't know if this is really the most natural definition for a human. I think there is something to be said for each of the three options:
1. a legal e.p. capture exists;
2. a pseudo legal e.p. capture exists (i.e. the opponent just played a double pawn move and there exists at least one adjacent pawn);
3. the opponent just played a double pawn move.
Option 1 is in accordance with FIDE rules. It is also the optimal one in terms of TT usage (when you use the same hash key for repetition detection and TT indexing). But it is also the most tricky one to implement correctly and efficiently.
Option 2 is what I think most engines implement (including mine). It loses a little bit in TT efficiency, but the loss is probably not measurable. It also loses a little bit in correctness of 3-fold repetition detection (but won't give false positives, so will not lead to disasters).
Option 3 is really suboptimal. I'm reasonably sure it costs Elo in the opening and it might miss some important cases of 3-fold repetition (but still won't give false positives).
I think FIDE's choice here was "good" for computer chess. Option 2 would have been OK as well, but option 3 would have lead to complications. The engine would have had to use option 1 or 2 for calculating the hash key used for indexing the TT (or accept a small Elo loss) but would have to use option 3 for calculating the hash key used for repetition detection (or risk false positives, which is really bad).
For castling on the other hand, it makes more sense to use a weaker definition. Because to separate RIGHT from POSSIBILITY can be a quite difficult matter, as shown in many places.
In my view the solution picked by FIDE for castling rights most resembles option 2. Slightly more "optimal" in terms of TT usage is to already lose the rights if the player to move is forced to move his rook or king, but it would be quite nasty to implement correctly. I'm pretty sure almost all programs would stick to following the present rules.