Implement a whole new move crate
This commit is contained in:
parent
0bedf2aa9f
commit
c55b7c4877
7 changed files with 512 additions and 148 deletions
34
moves/src/defs.rs
Normal file
34
moves/src/defs.rs
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Eryn Wells <eryn@erynwells.me>
|
||||
|
||||
use chessfriend_core::Shape;
|
||||
|
||||
pub(crate) enum Kind {
|
||||
Quiet = 0b00,
|
||||
DoublePush = 0b01,
|
||||
KingSideCastle = 0b10,
|
||||
QueenSideCastle = 0b11,
|
||||
Capture = 0b0100,
|
||||
EnPassantCapture = 0b0101,
|
||||
Promotion = 0b1000,
|
||||
CapturePromotion = 0b1100,
|
||||
}
|
||||
|
||||
#[repr(u16)]
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum PromotionShape {
|
||||
Knight = 0b00,
|
||||
Bishop = 0b01,
|
||||
Rook = 0b10,
|
||||
Queen = 0b11,
|
||||
}
|
||||
|
||||
impl From<PromotionShape> for Shape {
|
||||
fn from(value: PromotionShape) -> Self {
|
||||
match value {
|
||||
PromotionShape::Knight => Shape::Knight,
|
||||
PromotionShape::Bishop => Shape::Bishop,
|
||||
PromotionShape::Rook => Shape::Rook,
|
||||
PromotionShape::Queen => Shape::Queen,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue