From 6478176a7d1dff075012337abffb3c8331e0a28f Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Mon, 3 Feb 2025 13:47:27 +0100 Subject: [PATCH] fixed check condition --- cpp/src/board.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp/src/board.cpp b/cpp/src/board.cpp index f45c62d..6d2674a 100644 --- a/cpp/src/board.cpp +++ b/cpp/src/board.cpp @@ -287,7 +287,8 @@ bool Board::is_check_for(int8_t colour) const { std::vector moves = legal_moves(this->squares[i], *this, Coords::from_index(i), true); std::vector targets = to_target_square(moves); - if (std::find(targets.begin(), targets.end(), i) != targets.end()) + if (std::find(targets.begin(), targets.end(), king_idx) + != targets.end()) return true; } return false;