Struct reason_othello::Game[][src]

pub struct Game {
    pub board: Board,
    pub active_player: Player,
    // some fields omitted
}

A safe interface to game logic. Slower than Board, but implements a safer, checked interface.

Fields

board: Boardactive_player: Player

Implementations

impl Game[src]

pub fn new(board: Board, active_player: Player) -> Self[src]

Construct a game with an arbitrary Board. Results in invalid state if board is not a valid board.

pub fn apply_move(self, mv: Move) -> Result<Self, InvalidMoveError>[src]

Compute the game state after a move.

pub fn is_finished(self) -> bool[src]

Whether this board represents a finished game.

pub fn winner(self) -> Option<Player>[src]

Compute the winner of the game, or None if the game is not finished or the result is a draw.

Trait Implementations

impl Clone for Game[src]

impl Copy for Game[src]

impl Debug for Game[src]

impl Default for Game[src]

impl Display for Game[src]

impl Eq for Game[src]

impl FromStr for Game[src]

type Err = ParseGameError

The associated error which can be returned from parsing.

impl PartialEq<Game> for Game[src]

impl StructuralEq for Game[src]

impl StructuralPartialEq for Game[src]

Auto Trait Implementations

impl RefUnwindSafe for Game

impl Send for Game

impl Sync for Game

impl Unpin for Game

impl UnwindSafe for Game

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> Cast<U> for T where
    U: FromCast<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> FromCast<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.