diff --git a/src/position.cpp b/src/position.cpp index aad03c2e..d01df777 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -991,7 +991,7 @@ std::ostream& operator<<(std::ostream& os, const Position& position) { return os; } -bool Position::is_reversible(Move move) { +bool Position::is_reversible(Move move) const { return !(move.is_capture() || move.is_promotion() || move.is_castle() || (m_board[move.from()].ptype() == PieceType::Pawn)); } diff --git a/src/position.hpp b/src/position.hpp index f3df59bf..58a12ae1 100644 --- a/src/position.hpp +++ b/src/position.hpp @@ -305,7 +305,7 @@ struct Position { [[nodiscard]] u16 get_50mr_counter() const; - [[nodiscard]] bool is_reversible(Move move); + [[nodiscard]] bool is_reversible(Move move) const; const std::array calc_attacks_slow(); const std::array calc_attacks_slow(Square sq); diff --git a/src/search.cpp b/src/search.cpp index 10fce35a..5ef56ecf 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -579,7 +579,7 @@ Value Worker::search( ss->cont_hist_entry = &m_td.history.get_cont_hist_entry(pos, m); Position pos_after = pos.move(m, m_td.push_psqt_state(), &m_searcher.tt); - repetition_info.push(pos_after.get_hash_key(), pos_after.is_reversible(m)); + repetition_info.push(pos_after.get_hash_key(), pos.is_reversible(m)); Value probcut_value = -quiesce(pos_after, ss + 1, -probcut_beta, -probcut_beta + 1, ply + 1); @@ -740,7 +740,7 @@ Value Worker::search( moves_played++; // Put hash into repetition table. TODO: encapsulate this and any other future adjustment to do "on move" into a proper function - repetition_info.push(pos_after.get_hash_key(), pos_after.is_reversible(m)); + repetition_info.push(pos_after.get_hash_key(), pos.is_reversible(m)); // Get search value Depth new_depth = depth - 1 + extension; @@ -1066,7 +1066,7 @@ Value Worker::quiesce(const Position& pos, Stack* ss, Value alpha, Value beta, i moves.skip_quiets(); // Put hash into repetition table. TODO: encapsulate this and any other future adjustment to do "on move" into a proper function - repetition_info.push(pos_after.get_hash_key(), pos_after.is_reversible(m)); + repetition_info.push(pos_after.get_hash_key(), pos.is_reversible(m)); // Get search value Value value = -quiesce(pos_after, ss + 1, -beta, -alpha, ply + 1);