From e093339c2fc651eb9b5adeeb3b666b1fcfa7ad42 Mon Sep 17 00:00:00 2001 From: Pieter te Brake Date: Wed, 18 Mar 2026 20:42:56 +0100 Subject: [PATCH] Use existing function for removing and placing a piece. Passed non-regression STC: ``` LLR: 3.33 (-2.94,2.94) <-1.75,0.25> Total: 359712 W: 93077 L: 93175 D: 173460 Ptnml(0-2): 1088, 39816, 98144, 39722, 1086 ``` https://tests.stockfishchess.org/tests/view/69af5e9a6b61ccc788710e31 closes https://github.com/official-stockfish/Stockfish/pull/6667 No functional change --- src/position.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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)