Skip to content

Commit f3efcc6

Browse files
authored
fix!: respect ep square only if legal (#375)
This is a potentially breaking change for engines which don't handle this 100% correct since fastchess checks for 3 fold repetitions in the pv line and now it might realize that the game ended earlier and such as might mark moves as illegal which follow Fixes the issue where the following position wasn't adjudicated due to 3 fold repetition. This previously wasn't the case because h5 was a pseudo legal ep square ``` [Variant "From Position"] [FEN "6k1/1p2p1rp/rP1pR3/2pP1pP1/p1P2P1P/R5K1/8/8 b - - 0 1"] 1... h5 2. Rh6 Rh7 3. Re6 Rg7 4. Rh6 Rh7 5. Re6 Rg7 ```
1 parent 64b3561 commit f3efcc6

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

app/src/game/book/pgn_reader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class PGNVisitor : public chess::pgn::Visitor {
5252
return;
5353
}
5454

55-
board_.makeMove(move_i);
55+
board_.makeMove<true>(move_i);
5656

5757
if (board_.isGameOver().second != chess::GameResult::NONE) {
5858
early_stop_ = true;

app/src/game/epd/epd_builder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class EpdBuilder {
2323

2424
if (illegal) break;
2525

26-
board.makeMove(chess::uci::uciToMove(board, move.move));
26+
board.makeMove<true>(chess::uci::uciToMove(board, move.move));
2727
}
2828

2929
epd << board.getEpd() << "\n";

app/src/game/pgn/pgn_builder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ PgnBuilder::PgnBuilder(const config::Pgn &pgn_config, const MatchData &match, st
8282
const auto last = std::next(it) == match_.moves.end();
8383
const auto move_str = addMove(board, *it, move_number, n_dots, illegal, last);
8484

85-
board.makeMove(chess::uci::uciToMove(board, it->move));
85+
board.makeMove<true>(chess::uci::uciToMove(board, it->move));
8686

8787
move_number++;
8888

app/src/matchmaking/match/match.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Match::Match(const book::Opening& opening)
8282

8383
const auto insert_move = [&](const auto& opening_move) {
8484
const auto move = uci::moveToUci(opening_move, board_.chess960());
85-
board_.makeMove(opening_move);
85+
board_.makeMove<true>(opening_move);
8686

8787
return MoveData(move, "0.00", 0, 0, 0, 0, 0, true, true);
8888
};
@@ -360,7 +360,7 @@ bool Match::playMove(Player& us, Player& them) {
360360
return false;
361361
}
362362

363-
board_.makeMove(move);
363+
board_.makeMove<true>(move);
364364

365365
// CuteChess uses plycount/2 for its movenumber, which is wrong for epd books as it doesnt take
366366
// into account the fullmove counter of the starting FEN, leading to different behavior between
@@ -528,7 +528,7 @@ void Match::verifyPvLines(const Player& us) {
528528
break;
529529
}
530530

531-
board.makeMove(uci::uciToMove(board, *it_start));
531+
board.makeMove<true>(uci::uciToMove(board, *it_start));
532532

533533
it_start++;
534534
}

0 commit comments

Comments
 (0)