[core] Declare Rank::PAWN_STARTING_RANKS

This is a slice that declares the pawn starting ranks for each color.
This commit is contained in:
Eryn Wells 2024-01-28 15:52:41 -08:00
parent cb48413ce7
commit 1f78d4811a

View file

@ -159,6 +159,15 @@ impl Rank {
Rank::SEVEN,
Rank::EIGHT,
];
/// Ranks on which pawns start, by color.
///
/// ```
/// use chessfriend_core::{Color, Rank};
/// assert_eq!(Rank::PAWN_STARTING_RANKS[Color::White as usize], Rank::TWO);
/// assert_eq!(Rank::PAWN_STARTING_RANKS[Color::Black as usize], Rank::SEVEN);
/// ```
pub const PAWN_STARTING_RANKS: [Rank; 2] = [Rank::TWO, Rank::SEVEN];
}
#[rustfmt::skip]