[−][src]Struct shogai::board::Board
Fields
turn: Color
rules: 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]
&'a self,
mv: &'a str
) -> Result<&'a str, InvalidMoveError>
Check if a move is 100% valid
pub fn check_move_partial<'a>(
&'a self,
mv: &'a str
) -> Result<&'a str, InvalidMoveError>
[src]
&'a self,
mv: &'a str
) -> Result<&'a str, InvalidMoveError>
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]
&self,
complete_check: bool
) -> impl Iterator<Item = String>
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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]
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<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.
fn to_owned(&self) -> T
[src]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,