From e673e20a63232aa028d015e3376a63b9697fe2a7 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 27 Jul 2022 23:38:51 +0200 Subject: [PATCH] Add 'Color::third_rank' --- src/board/color.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/board/color.rs b/src/board/color.rs index f909aca..66b21b3 100644 --- a/src/board/color.rs +++ b/src/board/color.rs @@ -60,6 +60,16 @@ impl Color { } } + /// Return the third [Rank] for pieces of the given [Color], where its pawns move to after a + /// one-square move on the start position. + #[inline(always)] + pub fn third_rank(self) -> Rank { + match self { + Self::White => Rank::Third, + Self::Black => Rank::Sixth, + } + } + /// Return the fourth [Rank] for pieces of the given [Color], where its pawns move to after a /// two-square move. #[inline(always)]