pub struct Position { /* private fields */ }Expand description
Two disjoint bitboards and the side whose transition comes next.
Implementations§
Source§impl Position
impl Position
pub const fn start() -> Self
pub fn from_bits( black: u64, white: u64, side_to_move: Side, ) -> Result<Self, &'static str>
Sourcepub fn from_cassio(board: &str, side: &str) -> Result<Self, &'static str>
pub fn from_cassio(board: &str, side: &str) -> Result<Self, &'static str>
Parse the 64-cell board plus side token used by Cassio’s engine
protocol. X, B, or * denotes black; O or W denotes white.
Sourcepub fn to_cassio(self) -> String
pub fn to_cassio(self) -> String
Serialize a Cassio position as 64 cells followed immediately by X
or O for the side to move.
pub const fn bits(self, side: Side) -> u64
pub const fn occupied(self) -> u64
pub const fn side_to_move(self) -> Side
pub const fn empty_count(self) -> u8
pub const fn occupied_count(self) -> u8
pub const fn disc_count(self, side: Side) -> u8
pub fn side_at(self, square: Square) -> Option<Side>
pub fn legal_placement_bits(self) -> u64
pub fn legal_placements_for(self, side: Side) -> u64
pub fn frontier_bits(self, side: Side) -> u64
pub fn potential_mobility_bits(self, side: Side) -> u64
Sourcepub fn legal_moves(self) -> MoveList
pub fn legal_moves(self) -> MoveList
Returns every legal placement, or a single pass when one is required.
pub fn flips_for(self, square: Square) -> u64
pub fn result(self) -> GameResult
Sourcepub fn make_move(&mut self, mv: Move) -> Result<Undo, MoveError>
pub fn make_move(&mut self, mv: Move) -> Result<Undo, MoveError>
Plays one placement or forced pass and returns exact undo data.
Sourcepub fn unmake_move(&mut self, undo: Undo)
pub fn unmake_move(&mut self, undo: Undo)
Restores the position that existed before undo was produced.
pub fn from_moves(moves: &[Move]) -> Result<Self, MoveError>
pub fn mirrored(self) -> Self
Trait Implementations§
impl Copy for Position
impl Eq for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnsafeUnpin for Position
impl UnwindSafe for Position
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more