From 1f78d4811acff510db02a662203b52b686c3d7a8 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 28 Jan 2024 15:52:41 -0800 Subject: [PATCH] [core] Declare Rank::PAWN_STARTING_RANKS This is a slice that declares the pawn starting ranks for each color. --- core/src/coordinates.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/coordinates.rs b/core/src/coordinates.rs index 7e4be53..f40ccb1 100644 --- a/core/src/coordinates.rs +++ b/core/src/coordinates.rs @@ -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]