Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Zobrist keys for captures #5731

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ void Position::do_castling(Color us, Square from, Square& to, Square& rfrom, Squ

// Used to do a "null move": it flips
// the side to move without executing any move on the board.
void Position::do_null_move(StateInfo& newSt, TranspositionTable& tt) {
void Position::do_null_move(StateInfo& newSt, const TranspositionTable& tt) {

assert(!checkers());
assert(&newSt != st);
Expand Down Expand Up @@ -1071,10 +1071,7 @@ Key Position::key_after(Move m) const {
Piece captured = piece_on(to);
Key k = st->key ^ Zobrist::side;

if (captured)
k ^= Zobrist::psq[captured][to];

k ^= Zobrist::psq[pc][to] ^ Zobrist::psq[pc][from];
k ^= Zobrist::psq[captured][to] ^ Zobrist::psq[pc][to] ^ Zobrist::psq[pc][from];

return (captured || type_of(pc) == PAWN) ? k : adjust_key50<true>(k);
}
Expand Down
2 changes: 1 addition & 1 deletion src/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Position {
void do_move(Move m, StateInfo& newSt);
void do_move(Move m, StateInfo& newSt, bool givesCheck);
void undo_move(Move m);
void do_null_move(StateInfo& newSt, TranspositionTable& tt);
void do_null_move(StateInfo& newSt, const TranspositionTable& tt);
void undo_null_move();

// Static Exchange Evaluation
Expand Down
Loading