aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-26 15:44:24 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-26 15:44:24 +0300
commit79c2ddb687267816299d5c6f7a7551cf59bdf6b1 (patch)
tree06d5a92526dad1ac1308f1c2e0fe341474e131c1
parentba2a754a15dab9e461ba54b38047c32e4581dc44 (diff)
downloadchessnost-79c2ddb687267816299d5c6f7a7551cf59bdf6b1.tar.gz
fix: do not allow castling under check
-rw-r--r--src/board/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/board/mod.rs b/src/board/mod.rs
index e21aaf1..d8166c3 100644
--- a/src/board/mod.rs
+++ b/src/board/mod.rs
@@ -299,6 +299,7 @@ impl Board {
match rook_square.file() {
0 => {
let castle_line = [
+ king_home_position,
king_home_position.west_one(),
king_home_position.west_one().west_one(),
];
@@ -316,6 +317,7 @@ impl Board {
},
7 => {
let castle_line = [
+ king_home_position,
king_home_position.east_one(),
king_home_position.east_one().east_one(),
];