From ba2a754a15dab9e461ba54b38047c32e4581dc44 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 26 Jan 2023 15:41:15 +0300 Subject: fix: include king attacks in is_square_attacked --- src/board/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/board/mod.rs b/src/board/mod.rs index 8dbf476..e21aaf1 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -701,6 +701,11 @@ impl Board { return true } } + PieceType::King => { + if (self.attacks.king[square as usize] & piece > 0) { + return true + } + } PieceType::Knight => { if (self.attacks.knight[square as usize] & piece > 0) { return true @@ -721,7 +726,6 @@ impl Board { return true } } - PieceType::King => {} _ => panic!("Unexpected piece type! Pieces by color should be considered white") } } -- cgit v1.2.3