1
0
Fork 0

check, mate & en passant methods

This commit is contained in:
Paul-Nicolas Madelaine 2025-11-13 23:10:22 +01:00
parent 098071046d
commit d66828c861
4 changed files with 115 additions and 20 deletions

View file

@ -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>> {