From 43f9b1f988d0060c5d0249dfdf62b270c37b8602 Mon Sep 17 00:00:00 2001 From: rektdie Date: Fri, 23 May 2025 06:24:14 +0200 Subject: [PATCH] bugfix: listMoves printed pseudo-legal moves | bench 4333527 --- source/board.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/board.cpp b/source/board.cpp index 59be5b7..64a4287 100644 --- a/source/board.cpp +++ b/source/board.cpp @@ -251,11 +251,19 @@ void Board::ResetMoves() { } void Board::ListMoves() { + int moveCount = 1; for (int i = 0; i < currentMoveIndex; i++) { - std::cout << i+1 << ". "; + Board copy = *this; + bool isLegal = copy.MakeMove(moveList[i]); + + if (!isLegal) + continue; + + std::cout << moveCount << ". "; moveList[i].PrintMove(); std::cout << "( " << moveTypes[moveList[i].GetFlags()] << " )"; std::cout << std::endl; + moveCount++; } }