Describe the bug
|
template <bool RetAll = false> inline auto undoMove() -> std::conditional_t<RetAll, HistoryEntry<PieceC> &, void> { |
|
assert(!history.empty() && "undoMove called with empty history"); |
|
|
|
// Restore previous state from history |
|
assert(current_state.mv.is_ok() && "Corrupted history entry"); |
|
pieces_list[current_state.incr_sqs[0]] = current_state.incr_pc[0]; |
|
pieces_list[current_state.incr_sqs[1]] = current_state.incr_pc[1]; |
|
pieces_list[current_state.incr_sqs[2]] = current_state.incr_pc[2]; |
|
pieces_list[current_state.incr_sqs[3]] = current_state.incr_pc[3]; |
|
current_state = history.back(); |
|
history.pop_back(); |
|
if constexpr (RetAll) { |
|
return current_state; |
|
} |
|
return; |
|
} |
|
|
|
inline void doNullMove() { |
|
history.push_back(current_state); |
|
current_state.turn = ~current_state.turn; |
|
current_state.hash ^= zobrist::RandomTurn; |
|
current_state.fullMoveNumber += (current_state.turn == WHITE); |
|
current_state.pliesFromNull = current_state.repetition = 0; |
|
current_state.mv = Move::null(); |
|
} |
Minimal, Reproducible Example
#include <position.h>
int main(){Position p;p.doNullMove();p.undoMove();}
Partial test log
e.g. output from doctest/catch2 or your tester that's stripped to the failing test case
Full test log
Test log from the tester.
Hardware/Software info
List about the OS, hardware, compiler and tester.
Specifically, if the issue is reported by logic analysis, provide solution if applicable.
remove assert
Describe the bug
chesslib/position.h
Lines 170 to 194 in 71907da
Minimal, Reproducible Example
Partial test log
e.g. output from doctest/catch2 or your tester that's stripped to the failing test case
Full test log
Test log from the tester.
Hardware/Software info
List about the OS, hardware, compiler and tester.
Specifically, if the issue is reported by logic analysis, provide solution if applicable.
remove assert