From 58109c512074cdcca8309eeff04f51c7df779cfe Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Mon, 3 Feb 2025 13:49:40 +0100 Subject: [PATCH] fixed condition --- cpp/src/board.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cpp/src/board.cpp b/cpp/src/board.cpp index 6d2674a..ecf256c 100644 --- a/cpp/src/board.cpp +++ b/cpp/src/board.cpp @@ -296,11 +296,10 @@ bool Board::is_check_for(int8_t colour) const { bool Board::no_legal_moves_for(int8_t colour) const { for (int i = 0; i < 64; i++) { - if ((colour_at(i) == White && white_to_play) - || (colour_at(i) == Black && !white_to_play)) { - if (legal_moves(squares[i] & 0b111, *this, Coords::from_index(i)) - .size() - > 0) + if (colour_at(i) == colour) { + std::vector moves = + legal_moves(squares[i], *this, Coords::from_index(i)); + if (moves.size() > 0) return false; } }