Struct fen4::Board [−][src]
pub struct Board { pub turn: TurnColor, pub dead: [bool; 4], pub castling_king: [bool; 4], pub castling_queen: [bool; 4], pub points: [u16; 4], pub draw_ply: usize, pub extra_options: Extra, pub board: [[Piece; 14]; 14], }
Expand description
The board representation of a 4 player chess game. Board can be converted to and from a String in the fen4 format
The fen4 file format is very similar to the fen format for normal chess, but it uses a larger board and uses prefixes for the color of pieces instead of capitalization.
It also includes the metadata about castling rights at the beginning rather than the end and has some differences in what metadata is stored.
The default position (with no whitespace) is:
R-0,0,0,0-1,1,1,1-1,1,1,1-0,0,0,0-0-
3,yR,yN,yB,yK,yQ,yB,yN,yR,3/
3,yP,yP,yP,yP,yP,yP,yP,yP,3/
14/
bR,bP,10,gP,gR/
bN,bP,10,gP,gN/
bB,bP,10,gP,gB/
bK,bP,10,gP,gQ/
bQ,bP,10,gP,gK/
bB,bP,10,gP,gB/
bN,bP,10,gP,gN/
bR,bP,10,gP,gR/
14/
3,rP,rP,rP,rP,rP,rP,rP,rP,3/
3,rR,rN,rB,rQ,rK,rB,rN,rR,3
This format is shared for the Free-for-all and Teams mode so the dead and point metadata is useless in Teams, but is there because the format is shared with the FFA mode.
The metadata format is parsed into the struct as shown here:
v turn v king v points v extra
R-1,0,0,0-1,1,1,0-0,1,0,0-1,2,3,4-0-{'lifes':(2,2,2,2)}-
^ dead ^ queen ^ ply since last pawn move or capture
It starts with a Color, followed by 4 integer arrays of length 4, followed by 0, followed by an optional extra data section. Each of these is separated by a ‘-’. All of the arrays are information about the players with the leftmost data about Red and proceding clockwise.
Fields
turn: TurnColor
dead: [bool; 4]
castling_king: [bool; 4]
castling_queen: [bool; 4]
points: [u16; 4]
draw_ply: usize
extra_options: Extra
board: [[Piece; 14]; 14]
Implementations
Trait Implementations
impl Eq 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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more