In Move::capture_square, move the en passant check above the simple capture check

This commit is contained in:
Eryn Wells 2024-02-13 11:04:21 -07:00
parent e172bfb5dd
commit 5d1ad73be6

View file

@ -18,10 +18,6 @@ impl Move {
} }
pub fn capture_square(&self) -> Option<Square> { pub fn capture_square(&self) -> Option<Square> {
if self.is_capture() {
return Some(self.target_square());
}
if self.is_en_passant() { if self.is_en_passant() {
let target_square = self.target_square(); let target_square = self.target_square();
return Some(match target_square.rank() { return Some(match target_square.rank() {
@ -31,6 +27,10 @@ impl Move {
}); });
} }
if self.is_capture() {
return Some(self.target_square());
}
None None
} }