Trait minimax_alpha_beta::strategy::Strategy[][src]

pub trait Strategy {
    type Player;
    type Move;
    type Board;
    fn evaluate(&self) -> f64;
fn get_winner(&self) -> Self::Player;
fn is_game_tied(&self) -> bool;
fn is_game_complete(&self) -> bool;
fn get_available_moves(&self) -> Vec<Self::Move>;
fn play(&mut self, mv: &Self::Move, maximizer: bool);
fn clear(&mut self, mv: &Self::Move);
fn get_board(&self) -> &Self::Board;
fn is_a_valid_move(&self, mv: &Self::Move) -> bool;
fn get_a_sentinel_move(&self) -> Self::Move; }

Any two-player Minimax game must have this behavior. In other words, these functions should yield meaningful outputs for any two-player games.

Associated Types

Loading content...

Required methods

fn evaluate(&self) -> f64[src]

Ability to statically evaluate the current game state.

fn get_winner(&self) -> Self::Player[src]

Identify a winner, if exists.

fn is_game_tied(&self) -> bool[src]

Identify if the game is tied.

fn is_game_complete(&self) -> bool[src]

Identify if the game is in a completed state.

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

Ability to produce a collection of playable legal moves in the current position.

fn play(&mut self, mv: &Self::Move, maximizer: bool)[src]

Modify the game state by playing a given move.

fn clear(&mut self, mv: &Self::Move)[src]

Modify the game state by resetting a given move.

fn get_board(&self) -> &Self::Board[src]

Get the current state of the board.

fn is_a_valid_move(&self, mv: &Self::Move) -> bool[src]

Determine if a given move is valid.

fn get_a_sentinel_move(&self) -> Self::Move[src]

Ability to produce a sentinel (not-playable) move.

Loading content...

Implementors

impl Strategy for TicTacToe[src]

Endow upon TicTacToe the ability to play games.

type Player = char

The Player is a char. Usually one of ‘o’, ‘O’, ‘x’, ‘X’, ‘-’.

type Move = usize

The Move is a single number representing an index of the Board vector, i.e. in range [0, (size * size) - 1].

type Board = Vec<char>

The Board is a single vector of length size * size.

fn evaluate(&self) -> f64[src]

fn get_winner(&self) -> Self::Player[src]

fn is_game_tied(&self) -> bool[src]

fn is_game_complete(&self) -> bool[src]

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

fn play(&mut self, mv: &Self::Move, maximizer: bool)[src]

fn clear(&mut self, mv: &Self::Move)[src]

fn get_board(&self) -> &Self::Board[src]

fn is_a_valid_move(&self, mv: &Self::Move) -> bool[src]

fn get_a_sentinel_move(&self) -> Self::Move[src]

Loading content...