[][src]Struct shogai::board::Board

pub struct Board {
    pub turn: Color,
    pub rules: Rules,
    // some fields omitted
}

Fields

turn: Colorrules: Rules

Implementations

impl Board[src]

pub fn empty() -> Self[src]

return an empty shogiban

pub fn get_color(&self) -> Color[src]

return the turn (as White-Black Color, easier to visualize than a boolean)

pub fn get_turn(&self) -> bool[src]

return whether the current player is the first player (true) or the second (false)

pub fn value(&self) -> i32[src]

return the value of the shogiban for the current player (sum of his pieces value minus sum of opponent's pieces)

pub fn game_over(&self) -> bool[src]

return whether the current player is checkmated

pub fn contains(&self, pc: PieceType, color: Color) -> bool[src]

return whether the board (not the reserve) contains a piece of given type and color there may be such a pieces in one's

pub fn play_move(&self, mv: &str) -> Board[src]

Play a move (but check if it is legal beforehand, else panic with a nice error message) and return a new board containing pieces in their new position

pub fn play_move_unchecked(&self, mv: &str) -> Board[src]

Play a move and return a new board, but do no check if the move is legal, or even syntaxically correct. If given a illegal/incorrect move, this function will probably panic

pub fn check_move<'a>(
    &'a self,
    mv: &'a str
) -> Result<&'a str, InvalidMoveError>
[src]

Check if a move is 100% valid

pub fn check_move_partial<'a>(
    &'a self,
    mv: &'a str
) -> Result<&'a str, InvalidMoveError>
[src]

Check move, but not whether the king is uncovered or if the king is checkmated by a pawn drop

pub fn is_occupied_by(&self, pos: Position) -> Option<Piece>[src]

return Some(the_piece_in_that_position) or None if nothing was found there

pub fn add_piece(&mut self, piece: Piece)[src]

add a piece to the board

pub fn flip(&mut self)[src]

centrally rotate the board

pub fn set(&mut self, col: Color)[src]

set the regular starting position for one player

pub fn new<'a>() -> Board[src]

create new default board with the starting configuration

pub fn iter(&self) -> impl Iterator<Item = &Piece>[src]

iter over all the pieces in the board (and reserve)

pub fn iter_pawns(&self, c: Color) -> impl Iterator<Item = &Piece>[src]

iter over the pawns of the specified color

pub fn iter_pieces(&self, c: Color) -> impl Iterator<Item = &Piece>[src]

iterate over the pieces (not pawns) of the specified color

pub fn iter_moves(&self) -> impl Iterator<Item = String>[src]

iter over all possible moves

pub fn iter_moves_partial_check(&self) -> impl Iterator<Item = String>[src]

iter over all possible moves without considering uncovering the king of pawn-drop ceckmate

pub fn iter_normal_moves_only(
    &self,
    complete_check: bool
) -> impl Iterator<Item = String>
[src]

iter only over the normal (not drops)

Trait Implementations

impl Clone for Board[src]

impl Debug for Board[src]

impl Display for Board[src]

impl Eq for Board[src]

impl Hash for Board[src]

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> From<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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,