Board

Trait Board 

Source
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§

Source

type Move

The type representing a move in the game. This could be a simple u8 for a board position or a more complex struct for games with intricate actions.

Required Methods§

Source

fn get_current_player(&self) -> Player

Returns the player whose turn it is to make a move.

Source

fn get_outcome(&self) -> GameOutcome

Returns the current outcome of the game.

Source

fn get_available_moves(&self) -> Vec<Self::Move>

Returns a list of all legal moves available from the current state.

Source

fn perform_move(&mut self, b_move: &Self::Move)

Applies a given move to the board, modifying its state.

Source

fn get_hash(&self) -> u128

Returns a hash value for the current board 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.

Implementors§