Swap file and rank in Position
Because the chess positions read as "file-rank"
This commit is contained in:
@@ -29,15 +29,15 @@ impl Color {
|
||||
|
||||
#[derive(PartialEq, Eq, Hash, Clone)]
|
||||
pub struct Position {
|
||||
pub rank: Rank,
|
||||
pub file: File,
|
||||
pub rank: Rank,
|
||||
}
|
||||
|
||||
impl Position {
|
||||
pub fn new(rank: Rank, file: File) -> Position {
|
||||
pub fn new(file: File, rank: Rank) -> Position {
|
||||
Position {
|
||||
rank,
|
||||
file,
|
||||
rank,
|
||||
}
|
||||
}
|
||||
fn delta(
|
||||
@@ -190,7 +190,7 @@ impl PieceType {
|
||||
piece_type: self.clone(),
|
||||
color: color.clone(),
|
||||
},
|
||||
Position::new(color.get_pawn_rank(), file),
|
||||
Position::new(file, color.get_pawn_rank()),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -103,7 +103,7 @@ impl board::Position {
|
||||
let file = board::File::parse(chars.next().ok_or(())?)?;
|
||||
let rank = board::Rank::parse(chars.next().ok_or(())?)?;
|
||||
if chars.next().is_none() {
|
||||
Ok(board::Position::new(rank, file))
|
||||
Ok(board::Position::new(file, rank))
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user