In Move::capture_square, move the en passant check above the simple capture check
This commit is contained in:
parent
e172bfb5dd
commit
5d1ad73be6
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue