pub trait Board: Clone {
type Move;
// Required methods
fn get_current_player(&self) -> Player;
fn get_outcome(&self) -> GameOutcome;
fn get_available_moves(&self) -> Vec<Self::Move>;
fn perform_move(&mut self, b_move: &Self::Move);
fn get_hash(&self) -> u128;
}
Expand description
The central trait of the library, defining the interface for a game state.
To use the MCTS algorithm with a custom game, this trait must be implemented. It provides the MCTS engine with the necessary methods to understand and interact with the game logic.
Required Associated Types§
Required Methods§
Sourcefn get_current_player(&self) -> Player
fn get_current_player(&self) -> Player
Returns the player whose turn it is to make a move.
Sourcefn get_outcome(&self) -> GameOutcome
fn get_outcome(&self) -> GameOutcome
Returns the current outcome of the game.
Sourcefn get_available_moves(&self) -> Vec<Self::Move>
fn get_available_moves(&self) -> Vec<Self::Move>
Returns a list of all legal moves available from the current state.
Sourcefn perform_move(&mut self, b_move: &Self::Move)
fn perform_move(&mut self, b_move: &Self::Move)
Applies a given move to the board, modifying its state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.