1
0
Fork 0
This commit is contained in:
Paul-Nicolas Madelaine 2025-11-13 23:10:22 +01:00
parent 457e0c5aff
commit 882ffa9e8f

View file

@ -124,7 +124,7 @@ impl Position {
moves.len moves.len
} }
/// Discards the optional en passant target square. /// Discards the en passant target square.
/// ///
/// This function is useful to check for position equality, notably when implementing FIDE's /// This function is useful to check for position equality, notably when implementing FIDE's
/// draw by repetition rules. Note that this function will remove the en passant target square /// draw by repetition rules. Note that this function will remove the en passant target square
@ -153,10 +153,9 @@ impl Position {
self.0 self.0
} }
/// Tries to pass the turn to the other color, failing if it would leave the king in check. /// Returns the position after after passing the turn to the other color,
/// /// and `None` if the king in check. On success, this inverts the color to
/// When possible, this inverts the color to play and removes the en passant square if it /// play and discards the en passant square.
/// exists.
pub fn pass(&self) -> Option<Self> { pub fn pass(&self) -> Option<Self> {
let setup = &self.0; let setup = &self.0;
let blockers = setup.p_b_q | setup.n_b_k | setup.r_q_k; let blockers = setup.p_b_q | setup.n_b_k | setup.r_q_k;