Struct shogi::position::Position [−][src]
pub struct Position { /* fields omitted */ }
Expand description
Represents a state of the game.
Examples
use shogi::{Move, Position};
use shogi::bitboard::Factory as BBFactory;
use shogi::square::consts::*;
BBFactory::init();
let mut pos = Position::new();
pos.set_sfen("lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1").unwrap();
let m = Move::Normal{from: SQ_7G, to: SQ_7F, promote: false};
pos.make_move(m).unwrap();
assert_eq!("lnsgkgsnl/1r5b1/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL b - 1 moves 7g7f", pos.to_sfen());
Implementations
Returns a bitboard containing pieces of the given player.
Returns the side to make a move next.
Returns a history of all moves made since the beginning of the game.
Checks if a player with the given color can declare winning.
See the section 25 in http://www.computer-shogi.org/wcsc26/rule.pdf for more detail.
Makes the given move. Returns Err
if the move is invalid or any special condition is met.
Returns a list of squares at which a piece of the given color is pinned.
Undoes the last move.
Returns a list of squares to where the given pieve at the given square can move.
Parses the given SFEN string and updates the game state.