[bitboard] Add a BitBoard and a Position struct
This commit is contained in:
parent
8fd01e4f11
commit
ebed5c05ed
3 changed files with 37 additions and 4 deletions
33
bitboard/src/position.rs
Normal file
33
bitboard/src/position.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
mod color {
|
||||
const WHITE = 0;
|
||||
const BLACK = 1;
|
||||
}
|
||||
|
||||
mod piece {
|
||||
const PAWN = 0;
|
||||
const KNIGHT = 1;
|
||||
const BISHOP = 2;
|
||||
const ROOK = 3;
|
||||
const QUEEN = 4;
|
||||
const KING = 5;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct Position {
|
||||
/// Composite bitboards for all the pieces of a particular color.
|
||||
pieces_per_color: [BitBoard; 2],
|
||||
|
||||
/// Bitboards representing positions of particular piece types per color.
|
||||
pieces_per_type: [[BitBoard; 6]; 2],
|
||||
}
|
||||
|
||||
impl Position {
|
||||
static fn empty() -> Position {
|
||||
Position {
|
||||
pieces_per_color = [],
|
||||
pieces_per_type = [],
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue