[position] Rename fields of EnPassant struct
Append _square to each one.
This commit is contained in:
parent
0fc90a4a2e
commit
a65fcd6000
1 changed files with 8 additions and 5 deletions
|
@ -5,8 +5,8 @@ use chessfriend_core::{Rank, Square};
|
|||
/// En passant information.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct EnPassant {
|
||||
target: Square,
|
||||
capture: Square,
|
||||
target_square: Square,
|
||||
capture_square: Square,
|
||||
}
|
||||
|
||||
impl EnPassant {
|
||||
|
@ -34,18 +34,21 @@ impl EnPassant {
|
|||
/// ```
|
||||
pub fn from_target_square(target: Square) -> Option<Self> {
|
||||
match Self::_capture_square(target) {
|
||||
Some(capture) => Some(Self { target, capture }),
|
||||
Some(capture) => Some(Self {
|
||||
target_square: target,
|
||||
capture_square: capture,
|
||||
}),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The square the capturing piece will move to.
|
||||
pub fn target_square(&self) -> Square {
|
||||
self.target
|
||||
self.target_square
|
||||
}
|
||||
|
||||
/// The square on which the captured pawn sits.
|
||||
pub fn capture_square(&self) -> Square {
|
||||
self.capture
|
||||
self.capture_square
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue