[moves] Implement promotions and en passant in the PawnMoveGenerator

Add another sub-iterator to the PawnMoveGenerator that produces promotion pushes
or capture moves (depending on move_type) when a pawn moves to the back rank.

Also implement en passant moves.

Fix a bug in the Left and Right captures branches where the wrong neighbors used
to calculate origin squares.

Add a whole bunch of tests. Still missing several cases though.
This commit is contained in:
Eryn Wells 2025-05-24 18:01:14 -07:00
parent ab587f379f
commit 09bf17d66b
4 changed files with 305 additions and 14 deletions

View file

@ -6,7 +6,13 @@ pub use pawn::PawnMoveGenerator;
use crate::Move;
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct GeneratedMove {
pub(crate) ply: Move,
}
impl From<Move> for GeneratedMove {
fn from(value: Move) -> Self {
GeneratedMove { ply: value }
}
}