Struct reason_othello::Game [−][src]
A safe interface to game logic. Slower than Board
, but implements a safer, checked interface.
Fields
board: Board
active_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.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> Cast<U> for T where
U: FromCast<T>,
[src]
U: FromCast<T>,
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]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,