[board] Add neighbor and piece modules
Add a Direction enum in the neighbor module Add Color and PieceShape enums, and a Piece struct to the piece module
This commit is contained in:
parent
70d8034e4e
commit
9bcd0b2148
3 changed files with 48 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
mod bitboard;
|
||||
mod neighbor;
|
||||
mod piece;
|
||||
mod position;
|
||||
mod square;
|
||||
|
|
12
board/src/neighbor.rs
Normal file
12
board/src/neighbor.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
pub enum Direction {
|
||||
North,
|
||||
NorthWest,
|
||||
West,
|
||||
SouthWest,
|
||||
South,
|
||||
SouthEast,
|
||||
East,
|
||||
NorthEast,
|
||||
}
|
34
board/src/piece.rs
Normal file
34
board/src/piece.rs
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum Color {
|
||||
White,
|
||||
Black,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum PieceShape {
|
||||
Pawn,
|
||||
Knight,
|
||||
Bishop,
|
||||
Rook,
|
||||
Queen,
|
||||
King,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum PiecePlacementError {
|
||||
PieceExistsOnSquare,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Piece {
|
||||
pub color: Color,
|
||||
pub piece: PieceShape,
|
||||
}
|
||||
|
||||
impl Piece {
|
||||
pub fn new(color: Color, piece: PieceShape) -> Piece {
|
||||
Piece { color, piece }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue