Fix the pawn unit tests
This commit is contained in:
parent
63c03fb879
commit
2a6b098cb8
4 changed files with 112 additions and 45 deletions
|
@ -1,5 +1,6 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
use crate::Color;
|
||||
use std::fmt;
|
||||
use std::str::FromStr;
|
||||
|
||||
|
@ -168,6 +169,16 @@ impl Rank {
|
|||
/// assert_eq!(Rank::PAWN_STARTING_RANKS[Color::Black as usize], Rank::SEVEN);
|
||||
/// ```
|
||||
pub const PAWN_STARTING_RANKS: [Rank; 2] = [Rank::TWO, Rank::SEVEN];
|
||||
|
||||
pub const PAWN_DOUBLE_PUSH_TARGET_RANKS: [Rank; 2] = [Rank::FOUR, Rank::FIVE];
|
||||
|
||||
pub fn is_pawn_starting_rank(&self, color: Color) -> bool {
|
||||
self == &Self::PAWN_STARTING_RANKS[color as usize]
|
||||
}
|
||||
|
||||
pub fn is_pawn_double_push_target_rank(&self, color: Color) -> bool {
|
||||
self == &Self::PAWN_DOUBLE_PUSH_TARGET_RANKS[color as usize]
|
||||
}
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue