impl Default for Bitboard, Setup & Position
This commit is contained in:
parent
ebab07f5ae
commit
f7c47c4d85
3 changed files with 16 additions and 2 deletions
|
|
@ -3,7 +3,7 @@
|
|||
use crate::board::*;
|
||||
|
||||
/// A set of squares.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||
pub struct Bitboard(pub u64);
|
||||
|
||||
impl Bitboard {
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ impl Position {
|
|||
.as_setup()
|
||||
.en_passant
|
||||
.map(|square| square.bitboard())
|
||||
.unwrap_or(Bitboard::new()),
|
||||
.unwrap_or_default(),
|
||||
};
|
||||
self.generate_moves(&mut moves).is_break()
|
||||
}
|
||||
|
|
@ -478,6 +478,13 @@ impl core::fmt::Debug for Position {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Position {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub(crate) struct RawMove {
|
||||
pub kind: MoveType,
|
||||
|
|
|
|||
|
|
@ -541,6 +541,13 @@ impl core::fmt::Debug for Setup {
|
|||
}
|
||||
}
|
||||
|
||||
impl Default for Setup {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
/// An invalid position.
|
||||
///
|
||||
/// This is an illegal position that can't be represented with the [`Position`] type.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue