pub struct MancalaBoard {
    pub p1_board: [u32; 6],
    pub p2_board: [u32; 6],
    pub p1_store: u32,
    pub p2_store: u32,
    pub turn: Player,
}
Expand description

Contains data relevant to the game.

Fields

p1_board: [u32; 6]

The contents of Player One’s row.

p2_board: [u32; 6]

The contents of Player Two’s row.

p1_store: u32

The number of stones is Player One’s store.

p2_store: u32

The number of stones is Player Two’s store.

turn: Player

Indicates whose turn it is.

Implementations

Creates a new MancalaBoard with its values initialized to a new game layout according to the game rules of Mancala.

Make a move and update board data.

Arguments
  • self - the MancalaBoard to update
  • move_pit - The pit which the player has chosen to move
Return

Returns a tuple containing three variables:

  • The result of the move
  • Whether a bonus turn was earned
  • How many (if any) stones were captured

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.

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.