update documentation
This commit is contained in:
parent
ace749ac38
commit
4fc7e8d765
4 changed files with 23 additions and 23 deletions
|
|
@ -38,9 +38,9 @@ use core::ops::ControlFlow;
|
|||
/// to playable moves.
|
||||
///
|
||||
/// Playing a move is done through a copy-make interface. [`legal_moves`](Position::legal_moves)
|
||||
/// returns a sequence of [`Move<'l>`](Move) objects. Moves hold a reference to the position
|
||||
/// from where they were computed. They can be played without further checks and without potential
|
||||
/// panics using [`Move::make`].
|
||||
/// returns a list of [`Move<'l>`](Move) objects. Moves hold a reference to the position from where
|
||||
/// they were computed. They can be played without further checks and without potential panics
|
||||
/// using [`Move::make`].
|
||||
///
|
||||
/// ## En passant & Equality
|
||||
///
|
||||
|
|
@ -98,13 +98,13 @@ impl Position {
|
|||
})
|
||||
}
|
||||
|
||||
/// Returns the list of legal moves.
|
||||
/// Returns the list of legal moves from the position.
|
||||
#[inline]
|
||||
pub fn legal_moves<'l>(&'l self) -> Moves<'l> {
|
||||
Moves::compute(self)
|
||||
}
|
||||
|
||||
/// Returns the number of legal moves.
|
||||
/// Returns the number of legal moves from the position.
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub fn count_legal_moves(&self) -> usize {
|
||||
|
|
@ -197,7 +197,7 @@ impl Position {
|
|||
self.generate_moves(&mut moves).is_break()
|
||||
}
|
||||
|
||||
/// Discards the en passant target square.
|
||||
/// Removes the en passant target square, if any.
|
||||
///
|
||||
/// This function will remove the en passant target square even if taking en passant is legal.
|
||||
/// If this is not desirable, it is the caller's responsibility to rule out the legality of en
|
||||
|
|
@ -207,19 +207,19 @@ impl Position {
|
|||
self.0.en_passant = OptionSquare::None;
|
||||
}
|
||||
|
||||
/// Discards the castling rights for the given color and side.
|
||||
/// Removes the castling rights for the given color and side, if any.
|
||||
#[inline]
|
||||
pub fn remove_castling_rights(&mut self, color: Color, side: CastlingSide) {
|
||||
self.0.set_castling_rights(color, side, false);
|
||||
}
|
||||
|
||||
/// Borrows the position as a [`Setup`].
|
||||
/// Converts the position to the [`Setup`] type.
|
||||
#[inline]
|
||||
pub fn as_setup(&self) -> &Setup {
|
||||
&self.0
|
||||
}
|
||||
|
||||
/// Converts the position into the [`Setup`] type, allowing to edit it without enforcing its legality.
|
||||
/// Converts the position to the [`Setup`] type.
|
||||
#[inline]
|
||||
pub fn into_setup(self) -> Setup {
|
||||
self.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue