diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-08-31 14:58:40 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-08-31 15:22:52 +0300 |
commit | ea63c58ce7e9dbc0e1c0e1cb679a89c038e2edd3 (patch) | |
tree | 737b0dab341a8b3ab45097be739c8d6a203612b6 /src/moves.rs | |
parent | b60569d4b1c1342ca33e6b4bf1a2cfcd7d77960c (diff) | |
download | chessnost-ea63c58ce7e9dbc0e1c0e1cb679a89c038e2edd3.tar.gz |
fix: consider promotion a tactical move
Diffstat (limited to 'src/moves.rs')
-rw-r--r-- | src/moves.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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) } } |