Get en passant move building working (again?)

This commit is contained in:
Eryn Wells 2024-02-13 11:05:02 -07:00
parent 5d1ad73be6
commit 047eb4fd77
3 changed files with 28 additions and 16 deletions

View file

@ -270,14 +270,19 @@ impl Builder<Push> {
}
pub fn capturing_en_passant_on(self, square: Square) -> Builder<EnPassantCapture> {
let mut style = self.style;
style.to = Some(square);
match EnPassant::from_target_square(square) {
Some(en_passant) => {
let mut style = self.style;
style.to = Some(en_passant.target_square());
Builder {
style: EnPassantCapture {
push: self.style,
capture: Some(square),
},
Builder {
style: EnPassantCapture {
push: style,
capture: Some(en_passant.capture_square()),
},
}
}
None => todo!(),
}
}