From 933924d37a1d5fe9a01040ec77ffe4e8fd08e10c Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 18 Jun 2025 08:26:29 -0700 Subject: [PATCH] [board] When loading a FEN string, start with no castling rights The default value of the castle::Rights struct is with all rights granted. When loading a FEN string, start with none and add to it. --- board/src/fen.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/board/src/fen.rs b/board/src/fen.rs index 0da38dc..a125aca 100644 --- a/board/src/fen.rs +++ b/board/src/fen.rs @@ -229,9 +229,8 @@ impl FromFenStr for Board { let castling_rights = fields .next() .ok_or(FromFenStrError::MissingField(Field::CastlingRights))?; - if castling_rights == "-" { - board.revoke_all_castling_rights(); - } else { + board.revoke_all_castling_rights(); + if castling_rights != "-" { for ch in castling_rights.chars() { match ch { 'K' => board.grant_castling_right(Color::White, Wing::KingSide),