2024-01-19 17:51:57 -08:00
|
|
|
// Eryn Wells <eryn@erynwells.me>
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! position {
|
|
|
|
[$($color:ident $shape:ident on $square:ident),* $(,)?] => {
|
|
|
|
$crate::PositionBuilder::new()
|
2024-01-27 13:04:22 -08:00
|
|
|
$(.place_piece(
|
|
|
|
chessfriend_core::PlacedPiece::new(
|
|
|
|
chessfriend_core::Piece::new(
|
|
|
|
chessfriend_core::Color::$color,
|
|
|
|
chessfriend_core::Shape::$shape),
|
|
|
|
chessfriend_core::Square::$square
|
|
|
|
)
|
|
|
|
))*
|
2024-01-19 17:51:57 -08:00
|
|
|
.build()
|
|
|
|
};
|
|
|
|
}
|
2024-01-21 13:06:44 -08:00
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! test_position {
|
|
|
|
[$($color:ident $shape:ident on $square:ident),* $(,)?] => {
|
|
|
|
{
|
|
|
|
let pos = $crate::PositionBuilder::new()
|
2024-01-28 10:28:01 -08:00
|
|
|
$(.place_piece(
|
|
|
|
chessfriend_core::PlacedPiece::new(
|
|
|
|
chessfriend_core::Piece::new(
|
|
|
|
chessfriend_core::Color::$color,
|
|
|
|
chessfriend_core::Shape::$shape
|
|
|
|
),
|
|
|
|
chessfriend_core::Square::$square
|
|
|
|
))
|
|
|
|
)*
|
2024-01-21 13:06:44 -08:00
|
|
|
.build();
|
|
|
|
println!("{pos}");
|
|
|
|
pos
|
|
|
|
}
|
|
|
|
};
|
2024-01-28 09:47:25 -08:00
|
|
|
(empty) => {
|
|
|
|
{
|
|
|
|
let pos = Position::empty();
|
|
|
|
println!("{pos}");
|
|
|
|
pos
|
|
|
|
}
|
|
|
|
};
|
|
|
|
(starting) => {
|
|
|
|
{
|
|
|
|
let pos = Position::starting();
|
|
|
|
println!("{pos}");
|
|
|
|
pos
|
|
|
|
}
|
|
|
|
};
|
2024-01-21 13:06:44 -08:00
|
|
|
}
|