diff --git a/src/position.cpp b/src/position.cpp index f9b94b5dd..1a053e632 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1124,9 +1124,8 @@ void Position::undo_move(Move m) { assert(type_of(pc) == m.promotion_type()); assert(type_of(pc) >= KNIGHT && type_of(pc) <= QUEEN); - remove_piece(to); pc = make_piece(us, PAWN); - put_piece(pc, to); + swap_piece(to, pc); } if (m.type_of() == CASTLING)