37 lines
1.2 KiB
Rust
37 lines
1.2 KiB
Rust
// Eryn Wells <eryn@erynwells.me>
|
|
|
|
#[macro_export]
|
|
macro_rules! position {
|
|
[$($color:ident $shape:ident on $square:ident),* $(,)?] => {
|
|
$crate::Position::new(chessfriend_board::board!($($color $shape on $square),*))
|
|
};
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[macro_export]
|
|
macro_rules! test_position {
|
|
($to_move:ident, [ $($color:ident $shape:ident on $square:ident),* $(,)? ], $en_passant:ident) => {
|
|
{
|
|
let board = chessfriend_board::test_board!($to_move, [ $($color $shape on $square),*], $en_passant);
|
|
$crate::Position::new(board)
|
|
}
|
|
};
|
|
($to_move:ident, [ $($color:ident $shape:ident on $square:ident),* $(,)? ]) => {
|
|
{
|
|
let board = chessfriend_board::test_board!($to_move, [ $($color $shape on $square),* ]);
|
|
$crate::Position::new(board)
|
|
}
|
|
};
|
|
($($color:ident $shape:ident on $square:ident),* $(,)?) => {
|
|
{
|
|
let board = chessfriend_board::test_board!($($color $shape on $square),*);
|
|
$crate::Position::new(board)
|
|
}
|
|
};
|
|
(empty) => {
|
|
Position::new(chessfriend_board::test_board!(empty))
|
|
};
|
|
(starting) => {
|
|
Position::new(chessfriend_board::test_board!(starting))
|
|
};
|
|
}
|