From ea63c58ce7e9dbc0e1c0e1cb679a89c038e2edd3 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 31 Aug 2023 14:58:40 +0300 Subject: fix: consider promotion a tactical move --- src/moves.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/moves.rs') diff --git a/src/moves.rs b/src/moves.rs index da66247..b338afe 100644 --- a/src/moves.rs +++ b/src/moves.rs @@ -27,7 +27,7 @@ impl Move { /// Tactical move is a move that changes material score pub fn is_tactical(&self) -> bool { - matches!(self.kind, MoveKind::Capture | MoveKind::EnPassant) + matches!(self.kind, MoveKind::Capture | MoveKind::EnPassant | MoveKind::Promotion(_)) } pub fn from_notation(mut notation: Chars) -> Self { @@ -39,7 +39,7 @@ impl Move { 'r' => Piece::Rook, 'q' => Piece::Queen, 'b' => Piece::Bishop, - 'k' => Piece::Knight, + 'n' => Piece::Knight, _ => panic!("Illegal promotion piece: {:?}", promotion) }; return Move { source, target, kind: MoveKind::Promotion(piece) } @@ -56,7 +56,7 @@ impl Display for Move { Piece::Rook => "r", Piece::Queen => "q", Piece::Bishop => "b", - Piece::Knight => "k", + Piece::Knight => "n", _ => panic!("Illegal promotion piece: {:?}", piece) } } -- cgit v1.2.3