check, mate & en passant methods
This commit is contained in:
parent
098071046d
commit
d66828c861
4 changed files with 115 additions and 20 deletions
18
src/moves.rs
18
src/moves.rs
|
|
@ -265,18 +265,24 @@ impl<'l> Moves<'l> {
|
|||
self.array.len()
|
||||
}
|
||||
|
||||
/// Returns `true` if en passant is legal.
|
||||
#[inline]
|
||||
pub fn en_passant_is_legal(&self) -> bool {
|
||||
self.en_passant_is_legal
|
||||
}
|
||||
|
||||
/// Returns `true` if the king is in check.
|
||||
#[inline]
|
||||
pub fn is_check(&self) -> bool {
|
||||
self.is_check
|
||||
}
|
||||
|
||||
/// Returns `true` if there is no legal move on the position.
|
||||
#[inline]
|
||||
pub fn is_mate(&self) -> bool {
|
||||
self.array.len() == 0
|
||||
}
|
||||
|
||||
/// Returns `true` if taking en passant is legal on the position.
|
||||
#[inline]
|
||||
pub fn en_passant_is_legal(&self) -> bool {
|
||||
self.en_passant_is_legal
|
||||
}
|
||||
|
||||
/// Returns the move at the given index, if it exists.
|
||||
#[inline]
|
||||
pub fn get(&self, index: usize) -> Option<Move<'l>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue