aboutsummaryrefslogtreecommitdiff
path: root/src/board
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-26 15:41:15 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-26 15:41:15 +0300
commitba2a754a15dab9e461ba54b38047c32e4581dc44 (patch)
tree3b101c08fa6157eff967d6509a99db59d7ad9024 /src/board
parent3965ed40b05020eb7250a6270dd7df1bb3f5c4ee (diff)
downloadchessnost-ba2a754a15dab9e461ba54b38047c32e4581dc44.tar.gz
fix: include king attacks in is_square_attacked
Diffstat (limited to 'src/board')
-rw-r--r--src/board/mod.rs6
1 files changed, 5 insertions, 1 deletions
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")
}
}