src/chess/fen.c

changeset 223
e2519b3dd5e7
parent 221
338795f5837b
equal deleted inserted replaced
222:6388f9340a09 223:e2519b3dd5e7
88 88
89 return i; 89 return i;
90 } 90 }
91 91
92 static size_t fen_enpassant(char *str, const GameState *gamestate) { 92 static size_t fen_enpassant(char *str, const GameState *gamestate) {
93 93 /* We use the old specification where the en passant threat is always
94 * noted, regardless of a possible capture. This specification is also
95 * used by chess.com, for example. There is a modernized specification,
96 * which states that the threat is only to be noted when there is a valid
97 * capturing move for the active color (lichess.org uses this version of
98 * the specification). But this is unnecessarily complicated and as long
99 * as the old spec is still valid and commonly used, we implement the easy
100 * version.
101 */
94 str[0] = '-'; 102 str[0] = '-';
95 103
96 for (int file = 0 ; file < 8 ; file++) { 104 for (int file = 0 ; file < 8 ; file++) {
97 if (enpassant_threat_exists(gamestate, file, 3)) { 105 if (enpassant_threat_exists(gamestate, file, 3)) {
98 str[0] = filechr(file); 106 str[0] = filechr(file);

mercurial