[moves] Update ply! to take a color to the castle move

This supports castle moves having target and origin squares.
This commit is contained in:
Eryn Wells 2025-06-12 17:41:31 -07:00
parent 6a8cc0dc5b
commit e9cea33c20
2 changed files with 12 additions and 6 deletions

View file

@ -258,7 +258,7 @@ mod tests {
ply!(E1 - E2),
ply!(E1 - F1),
ply!(E1 - F2),
ply!(0 - 0),
ply!(White 0-0),
]
);
}
@ -279,7 +279,7 @@ mod tests {
ply!(E1 - E2),
ply!(E1 - F1),
ply!(E1 - F2),
ply!(0 - 0 - 0),
ply!(White 0-0-0),
]
);
}

View file

@ -46,11 +46,17 @@ macro_rules! ply {
$crate::PromotionShape::$promotion,
)
};
(0-0) => {
$crate::Move::castle(chessfriend_core::Wing::KingSide)
($color:ident 0-0) => {
$crate::Move::castle(
chessfriend_core::Color::$color,
chessfriend_core::Wing::KingSide,
)
};
(0-0-0) => {
$crate::Move::castle(chessfriend_core::Wing::QueenSide)
($color:ident 0-0-0) => {
$crate::Move::castle(
chessfriend_core::Color::$color,
chessfriend_core::Wing::QueenSide,
)
};
}