diff --git a/cpp/src/model/board/board.cpp b/cpp/src/model/board/board.cpp index 4760373..97c2b10 100644 --- a/cpp/src/model/board/board.cpp +++ b/cpp/src/model/board/board.cpp @@ -267,6 +267,12 @@ Board Board::make_move(Move move) const { } } + ret.n_half_moves = n_half_moves + 1; + if (is_capturing || piece_at(move.source_square) == Piece::Pawn) + ret.n_half_moves = 0; + if (!white_to_play) + ret.n_full_moves = n_full_moves + 1; + return ret; } diff --git a/cpp/src/model/board/board.hpp b/cpp/src/model/board/board.hpp index 7233f2f..000ab22 100644 --- a/cpp/src/model/board/board.hpp +++ b/cpp/src/model/board/board.hpp @@ -43,7 +43,7 @@ struct Board { } bool is_terminal() const { - return insufficient_material() || white_to_play + return n_half_moves == 100 || insufficient_material() || white_to_play ? is_checkmate_for(White) || is_stalemate_for(White) : is_checkmate_for(Black) || is_stalemate_for(Black); }