pub struct AtaxxBoard { /* private fields */ }
Implementations§
Source§impl AtaxxBoard
impl AtaxxBoard
pub const MAX_SIZE: u8 = 8u8
pub fn from_parts( size: u8, tiles_a: BitBoard8, tiles_b: BitBoard8, gaps: BitBoard8, moves_since_last_copy: u8, next_player: Player, ) -> Self
pub fn diagonal(size: u8) -> Self
pub fn empty(size: u8) -> Self
pub fn valid_coord(&self, coord: Coord8) -> bool
pub fn full_mask(&self) -> BitBoard8
pub fn tile(&self, coord: Coord8) -> Option<Player>
pub fn moves_since_last_copy(&self) -> u8
pub fn size(&self) -> u8
pub fn tiles_a(&self) -> BitBoard8
pub fn tiles_b(&self) -> BitBoard8
pub fn gaps(&self) -> BitBoard8
pub fn free_tiles(&self) -> BitBoard8
Sourcepub fn must_pass(&self) -> bool
pub fn must_pass(&self) -> bool
Returns whether the current played must pass. Returns false if the game is already done.
pub fn tiles_pov(&self) -> (BitBoard8, BitBoard8)
pub fn assert_valid(&self)
pub fn map_coord(&self, coord: Coord8, sym: D4Symmetry) -> Coord8
pub fn map_tiles(&self, tiles: BitBoard8, sym: D4Symmetry) -> BitBoard8
Source§impl AtaxxBoard
impl AtaxxBoard
pub fn from_fen(fen: &str) -> Result<AtaxxBoard, InvalidAtaxxFen>
pub fn to_fen(&self) -> String
Trait Implementations§
Source§impl Board for AtaxxBoard
impl Board for AtaxxBoard
Source§fn next_player(&self) -> Player
fn next_player(&self) -> Player
Return the next player to make a move.
If the board is done this is the player that did not play the last move for consistency.
Source§fn is_available_move(&self, mv: Self::Move) -> Result<bool, BoardDone>
fn is_available_move(&self, mv: Self::Move) -> Result<bool, BoardDone>
Return whether the given move is available.
Source§fn random_available_move(
&self,
rng: &mut impl Rng,
) -> Result<Self::Move, BoardDone>
fn random_available_move( &self, rng: &mut impl Rng, ) -> Result<Self::Move, BoardDone>
Pick a random move from the
available_moves
with a uniform distribution.
Can be overridden for better performance.Source§fn play(&mut self, mv: Self::Move) -> Result<(), PlayError>
fn play(&mut self, mv: Self::Move) -> Result<(), PlayError>
Play the move
mv
, modifying this board.Source§fn outcome(&self) -> Option<Outcome>
fn outcome(&self) -> Option<Outcome>
The outcome of this board, is
None
when this games is not done yet.Source§fn can_lose_after_move() -> bool
fn can_lose_after_move() -> bool
Whether the player who plays a move can lose by playing that move.
Symbolically whether
b.won_by() == Some(Winner::Player(b.next_player()))
can ever be true.
This may be pessimistic, returning true
is always correct.Source§fn clone_and_play(&self, mv: Self::Move) -> Result<Self, PlayError>
fn clone_and_play(&self, mv: Self::Move) -> Result<Self, PlayError>
Clone this board, play
mv
on it and return the new board.
Can be overridden for better performance.Source§impl<'a> BoardMoves<'a, AtaxxBoard> for AtaxxBoard
impl<'a> BoardMoves<'a, AtaxxBoard> for AtaxxBoard
type AllMovesIterator = AllMovesIterator<AtaxxBoard>
type AvailableMovesIterator = AvailableMovesIterator<'a, AtaxxBoard>
Source§fn all_possible_moves() -> Self::AllMovesIterator
fn all_possible_moves() -> Self::AllMovesIterator
All theoretically possible moves, for any possible board.
Moves returned by
available_moves
will always be a subset of these moves.
The order of these moves does not need to match the order from available_moves
.Source§fn available_moves(&'a self) -> Result<Self::AvailableMovesIterator, BoardDone>
fn available_moves(&'a self) -> Result<Self::AvailableMovesIterator, BoardDone>
Return an iterator over available moves, is always nonempty. No guarantees are made about the ordering except
that it stays consistent when the board is not modified.
Panics if this board is done.
Source§impl BoardSymmetry<AtaxxBoard> for AtaxxBoard
impl BoardSymmetry<AtaxxBoard> for AtaxxBoard
Source§type Symmetry = D4Symmetry
type Symmetry = D4Symmetry
The type used to represent symmetries.
Source§type CanonicalKey = (u64, u64, u64)
type CanonicalKey = (u64, u64, u64)
The type used by Self::canonical_key.
Source§fn map_move(&self, sym: Self::Symmetry, mv: Move) -> Move
fn map_move(&self, sym: Self::Symmetry, mv: Move) -> Move
Map a move under the given symmetry.
Source§fn canonical_key(&self) -> Self::CanonicalKey
fn canonical_key(&self) -> Self::CanonicalKey
Extract all of the state from this board that can potentially change when calling Self::map.
This is used by Self::canonicalize to determine which symmetry ends up as the canonical one for the given board.
Source§fn canonicalize(&self) -> Self
fn canonicalize(&self) -> Self
Convert this board to a canonical version,
by mapping it with the symmetry that results in the smallest Self::canonical_key. Read more
Source§impl Clone for AtaxxBoard
impl Clone for AtaxxBoard
Source§fn clone(&self) -> AtaxxBoard
fn clone(&self) -> AtaxxBoard
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AtaxxBoard
impl Debug for AtaxxBoard
Source§impl Default for AtaxxBoard
impl Default for AtaxxBoard
Source§impl Display for AtaxxBoard
impl Display for AtaxxBoard
Source§impl Hash for AtaxxBoard
impl Hash for AtaxxBoard
Source§impl Heuristic<AtaxxBoard> for AtaxxTileHeuristic
impl Heuristic<AtaxxBoard> for AtaxxTileHeuristic
Source§fn value(&self, board: &AtaxxBoard, length: u32) -> Self::V
fn value(&self, board: &AtaxxBoard, length: u32) -> Self::V
Return the heuristic value for the given board from the the next player POV.
depth
is the current depth, the number of moves played since the board the search was started on.
Can be used to prefer faster wins or slower losses.Source§impl PartialEq for AtaxxBoard
impl PartialEq for AtaxxBoard
impl Alternating for AtaxxBoard
impl Eq for AtaxxBoard
impl StructuralPartialEq for AtaxxBoard
Auto Trait Implementations§
impl Freeze for AtaxxBoard
impl RefUnwindSafe for AtaxxBoard
impl Send for AtaxxBoard
impl Sync for AtaxxBoard
impl Unpin for AtaxxBoard
impl UnwindSafe for AtaxxBoard
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more