pub struct TicTacToe {
    pub board: Vec<char>,
    pub size: usize,
    pub default_char: char,
    pub maximizer: char,
    pub minimizer: char,
}

Fields

board: Vec<char>size: usizedefault_char: charmaximizer: charminimizer: char

Implementations

Implements all necessary methods to operate a TicTacToe game.

Check the main and anti-diagonals for a winner.

Check the rows of the grid for a winner.

Check the columns of the grid for a winner.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Endow upon TicTacToe the ability to play games.

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

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

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

Ability to statically evaluate the current game state.

Identify a winner, if exists.

Identify if the game is tied.

Identify if the game is in a completed state.

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

Modify the game state by playing a given move.

Modify the game state by resetting a given move.

Get the current state of the board.

Determine if a given move is valid.

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

Auto Trait Implementations

Blanket Implementations

The ability to get the best move in the current state and for the current player. Read more

The ability to produce a best (good enough, sometimes) evaluation score possible over all possible moves at the current game state. Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.