Struct minimax_alpha_beta::tictactoe::TicTacToe [−][src]
pub struct TicTacToe { pub board: Vec<char>, pub size: usize, pub default_char: char, pub maximizer: char, pub minimizer: char, }
Contains basic data about a TicTacToe game.
Fields
board: Vec<char>
size: usize
default_char: char
maximizer: char
minimizer: char
Implementations
impl TicTacToe
[src]
impl TicTacToe
[src]Implements all necessary methods to operate a TicTacToe game.
pub fn create_game(
size: usize,
default_char: Option<char>,
maximizer: Option<char>,
minimizer: Option<char>
) -> TicTacToe
[src]
pub fn create_game(
size: usize,
default_char: Option<char>,
maximizer: Option<char>,
minimizer: Option<char>
) -> TicTacToe
[src]Create a new game of TicTacToe with a fresh board.
pub fn print_board(&self)
[src]
pub fn print_board(&self)
[src]Pretty print a TicTacToe board for visualizing a game state.
pub fn check_diagonals(&self) -> char
[src]
pub fn check_diagonals(&self) -> char
[src]Check the main and anti-diagonals for a winner.
pub fn check_rows(&self) -> char
[src]
pub fn check_rows(&self) -> char
[src]Check the rows of the grid for a winner.
pub fn check_cols(&self) -> char
[src]
pub fn check_cols(&self) -> char
[src]Check the columns of the grid for a winner.
Trait Implementations
impl Strategy for TicTacToe
[src]
impl Strategy for TicTacToe
[src]Endow upon TicTacToe the ability to play games.
type Move = usize
type Move = usize
The Move is a single number representing an
index of the Board vector, i.e. in range
[0, (size * size) - 1]
.
fn get_winner(&self) -> Self::Player
[src]
fn get_winner(&self) -> Self::Player
[src]Identify a winner, if exists.
fn is_game_tied(&self) -> bool
[src]
fn is_game_tied(&self) -> bool
[src]Identify if the game is tied.
fn is_game_complete(&self) -> bool
[src]
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]
fn get_available_moves(&self) -> Vec<Self::Move>
[src]Ability to produce a collection of playable legal moves in the current position. Read more
fn play(&mut self, mv: &Self::Move, maximizer: bool)
[src]
fn play(&mut self, mv: &Self::Move, maximizer: bool)
[src]Modify the game state by playing a given move.
fn is_a_valid_move(&self, mv: &Self::Move) -> bool
[src]
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]
fn get_a_sentinel_move(&self) -> Self::Move
[src]Ability to produce a sentinel (not-playable) move.
Auto Trait Implementations
impl RefUnwindSafe for TicTacToe
impl Send for TicTacToe
impl Sync for TicTacToe
impl Unpin for TicTacToe
impl UnwindSafe for TicTacToe
Blanket Implementations
impl<T> AlphaBetaMiniMaxStrategy for T where
T: Strategy,
[src]
impl<T> AlphaBetaMiniMaxStrategy for T where
T: Strategy,
[src]impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more