mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-14 13:32:23 +00:00
LibChess: Fix the ability to counter check with another check
fixes #3187,#3171
This commit is contained in:
parent
d2cb5e0f48
commit
e80d0abb2c
Notes:
sideshowbarker
2024-07-19 03:22:16 +09:00
Author: https://github.com/petelliott
Commit: e80d0abb2c
Pull-request: https://github.com/SerenityOS/serenity/pull/3214
Issue: https://github.com/SerenityOS/serenity/issues/3171
Issue: https://github.com/SerenityOS/serenity/issues/3187
Reviewed-by: https://github.com/Dexesttp
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/awesomekling
1 changed files with 1 additions and 5 deletions
|
@ -334,11 +334,7 @@ bool Board::in_check(Colour colour) const
|
|||
|
||||
bool check = false;
|
||||
Square::for_each([&](const Square& square) {
|
||||
if (is_legal({ square, king_square }, opposing_colour(colour))) {
|
||||
check = true;
|
||||
return IterationDecision::Break;
|
||||
} else if (get_piece(square) == Piece(opposing_colour(colour), Type::King) && is_legal_no_check({ square, king_square }, opposing_colour(colour))) {
|
||||
// The King is a special case, because it would be in check if it put the opposing king in check.
|
||||
if (is_legal_no_check({ square, king_square }, opposing_colour(colour))) {
|
||||
check = true;
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue