Struct reason_othello::Board[][src]

pub struct Board {
    pub active_bitboard: Bitboard,
    pub opponent_bitboard: Bitboard,
    pub just_passed: bool,
}

The complete state of an Othello game, seen from one player’s perspective.

Acts as a convenient thin wrapper for bitboard operations, at a medium level of abstraction ideal for engines.

Board operations are guaranteed to preserve validity contracts, but cannot check them on creation; may cause undefined behavior if invalid data is passed or if Board::pass and Board::apply_move are applied when they are not allowed.

Fields

active_bitboard: Bitboardopponent_bitboard: Bitboardjust_passed: bool

Implementations

impl Board[src]

pub fn get_moves(self) -> LocationList

Notable traits for LocationList

impl Iterator for LocationList type Item = Location;
[src]

Compute a list of all legal moves out of this position by the active player.

pub fn apply_move(self, loc: Location) -> Self[src]

Compute the board after a non-pass move, without checking that this is valid. Undefined behavior if the location is occupied or not a valid move.

pub fn pass(self) -> Self[src]

Compute the board after a pass. Results in inconsistent state if the active player has legal moves.

pub fn swap_players(self) -> Self[src]

Compute the board from the opponent’s perspective.

pub fn score_absolute_difference(self) -> i8[src]

Score the board for the active player as the absolute piece count difference. Faster than Self::score_winner_gets_empties(), but less common.

pub fn score_winner_gets_empties(self) -> i8[src]

Score the board for the active player as as the piece count difference where empty spaces are scored for the winner.

pub fn occupied_mask(self) -> Bitboard[src]

Get a mask of occupied spaces on the board.

pub fn empty_mask(self) -> Bitboard[src]

Get a mask of unoccupied spaces on the board.

Trait Implementations

impl Clone for Board[src]

impl Copy for Board[src]

impl Debug for Board[src]

impl Default for Board[src]

Get the starting board for the starting player.

impl Display for Board[src]

impl Eq for Board[src]

impl FromStr for Board[src]

type Err = ParseBoardError

The associated error which can be returned from parsing.

fn from_str(board_str: &str) -> Result<Self, Self::Err>[src]

Parse a board in the FFO format, assuming Black is going first.

impl PartialEq<Board> for Board[src]

impl StructuralEq for Board[src]

impl StructuralPartialEq for Board[src]

Auto Trait Implementations

impl RefUnwindSafe for Board

impl Send for Board

impl Sync for Board

impl Unpin for Board

impl UnwindSafe for Board

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.