Struct board_game::games::dummy::DummyGame
source · pub struct DummyGame { /* private fields */ }
Trait Implementations§
source§impl Board for DummyGame
impl Board for DummyGame
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 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 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 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, DummyGame> for DummyGame
impl<'a> BoardMoves<'a, DummyGame> for DummyGame
type AllMovesIterator = ClonableInternal<RangeFrom<usize>>
type AvailableMovesIterator = ClonableInternal<Range<usize>>
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<DummyGame> for DummyGame
impl BoardSymmetry<DummyGame> for DummyGame
§type Symmetry = UnitSymmetry
type Symmetry = UnitSymmetry
The type used to represent symmetries.
§type CanonicalKey = ()
type CanonicalKey = ()
The type used by Self::canonical_key.
source§fn map_move(
&self,
_: Self::Symmetry,
mv: <DummyGame as Board>::Move
) -> <DummyGame as Board>::Move
fn map_move( &self, _: Self::Symmetry, mv: <DummyGame as Board>::Move ) -> <DummyGame as Board>::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 PartialEq<DummyGame> for DummyGame
impl PartialEq<DummyGame> for DummyGame
impl Alternating for DummyGame
impl Eq for DummyGame
impl StructuralEq for DummyGame
impl StructuralPartialEq for DummyGame
Auto Trait Implementations§
impl RefUnwindSafe for DummyGame
impl Send for DummyGame
impl Sync for DummyGame
impl Unpin for DummyGame
impl UnwindSafe for DummyGame
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