[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:
Eryn Wells 2023-12-23 09:18:01 -07:00
parent 70d8034e4e
commit 9bcd0b2148
3 changed files with 48 additions and 0 deletions

View file

@ -1,3 +1,5 @@
mod bitboard;
mod neighbor;
mod piece;
mod position;
mod square;

12
board/src/neighbor.rs Normal file
View 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
View 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 }
}
}