pub trait Game {
type Position;
type NimberSet: NimberSet;
// Required methods
fn moves_count(&self, position: &Self::Position) -> u16;
fn initial_position(&self) -> Self::Position;
// Provided methods
fn try_solve_theoretically(&self, _position: &Self::Position) -> Option<u8> { ... }
fn theoretical_solutions(&self) -> TheoreticalSolutions<'_, Self> { ... }
fn is_initial_position_winning(&self) -> Option<bool> { ... }
}
Expand description
All games have to implement this trait, plus either SimpleGame (if game hasn’t decomposable positions) or DecomposableGame (if game has decomposable positions).
Required Associated Types§
Required Methods§
sourcefn moves_count(&self, position: &Self::Position) -> u16
fn moves_count(&self, position: &Self::Position) -> u16
Returns the number of moves available in the position
given.
sourcefn initial_position(&self) -> Self::Position
fn initial_position(&self) -> Self::Position
Returns the initial game position.
Provided Methods§
sourcefn try_solve_theoretically(&self, _position: &Self::Position) -> Option<u8>
fn try_solve_theoretically(&self, _position: &Self::Position) -> Option<u8>
Tries to provide theoretical solution for (i.e. the nimber of) the given position
.
One can use dbs::TheoreticalSolutions
provider returned by self.theoretical_solutions()
as an const_db
of any solver to utilize this method during search.
The default implementation returns None
.
sourcefn theoretical_solutions(&self) -> TheoreticalSolutions<'_, Self>
fn theoretical_solutions(&self) -> TheoreticalSolutions<'_, Self>
Returns nimber provider that delegates get_nimber
to self.try_solve_theoretically
.
sourcefn is_initial_position_winning(&self) -> Option<bool>
fn is_initial_position_winning(&self) -> Option<bool>
Returns the outcome of the initial position if it is known.
Object Safety§
This trait is not object safe.