Skip to content
Merged
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: 7 additions & 0 deletions position.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ template <typename PieceC = EnginePiece, typename = std::enable_if_t<is_piece_en

inline void doNullMove() {
history.push_back(current_state);
current_state.incr_sqs[0] = current_state.incr_sqs[1] = current_state.incr_sqs[2] = current_state.incr_sqs[3] = SQ_NONE;
current_state.incr_pc[0] = current_state.incr_pc[1] = current_state.incr_pc[2] = current_state.incr_pc[3] =
PieceC::NO_PIECE;
if (current_state.epIncluded)
current_state.hash ^= zobrist::RandomEP[file_of(ep_square())];
current_state.epIncluded = false;
current_state.enPassant = SQ_NONE;
current_state.turn = ~current_state.turn;
current_state.hash ^= zobrist::RandomTurn;
current_state.fullMoveNumber += (current_state.turn == WHITE);
Expand Down
23 changes: 23 additions & 0 deletions tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,29 @@ TEST_CASE("Experienced bugs in this repo") {
REQUIRE(p.zobrist() == p.hash());
REQUIRE(p.hash() == 4177524090105507023);
}
{
Position p;
p.doMove<false>(Move(SQ_A2, SQ_A3));
REQUIRE(p.zobrist() == p.hash());
p.doMove<false>(Move(SQ_B8, SQ_A6));
REQUIRE(p.zobrist() == p.hash());
p.doMove<false>(Move(SQ_F2, SQ_F3));
REQUIRE(p.zobrist() == p.hash());
p.doMove<false>(Move(SQ_F7, SQ_F5));
Comment thread
winapiadmin marked this conversation as resolved.
REQUIRE(p.zobrist() == p.hash());
p.doNullMove();
REQUIRE(p.zobrist() == p.hash());
p.undoMove();
REQUIRE(p.zobrist() == p.hash());
p.undoMove();
REQUIRE(p.zobrist() == p.hash());
p.undoMove();
REQUIRE(p.zobrist() == p.hash());
p.undoMove();
REQUIRE(p.zobrist() == p.hash());
p.undoMove();
REQUIRE(p.zobrist() == p.hash());
}
{
Position p;
REQUIRE(p.getCastlingPath(WHITE, true) == 0x60);
Expand Down
Loading