pub struct Game {
    current: Board,
    selected_piece: Option<BrdIdx>,
    previous_boards: Vec<Board>,
    painter: Option<Painter>,
    search_depth: usize,
    pub last_node_count: usize,
    pub perfect_chance: f64,
}
Expand description

Root-level structure for managing the game as a collection of board states

Fields

current: Boardselected_piece: Option<BrdIdx>previous_boards: Vec<Board>painter: Option<Painter>search_depth: usizelast_node_count: usizeperfect_chance: f64

Implementations

Get a read-only copy of a previous turn’s board

Set current board to given

Get pointer to current board’s squares

Get pointer to current board’s squares

Current turn’s team

Current board’s score

Get currently winning player

Check if a player has won

Get square on current board for given index

Set tree depth for AI to search to

Set given index as selected piece TODO: Check whether valid square?

Set proportion of perfect moves from AI

Clear currently selected piece

Attempt to make a move given a source and destination index

Update board state with given move and push new board into current state

Update board state with given jump move and push new board into current state

Push current board into the previous turns and set given board to current

Set current board to given

Get new game without board renderer

Get a new game with canvas ID and dimensions

Set painter for rendering boards

Draw current board using painter if exists

Create computer, get move from current board and update current board

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

Recover a Self from Self::Abi. Read more

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary. Read more

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi. Read more

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more

The wasm ABI type references to Self are recovered from.

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don’t persist beyond one function call, and so that they remain anonymous. Read more

Recover a Self::Anchor from Self::Abi. Read more

Same as RefFromWasmAbi::Abi

Same as RefFromWasmAbi::Anchor

Same as RefFromWasmAbi::ref_from_abi

Auto Trait Implementations

Blanket Implementations

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.

Same as IntoWasmAbi::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err. 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.