31 lines
936 B
Rust
31 lines
936 B
Rust
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
use super::bitboard::bitmove::BitMoveType;
|
|
|
|
#[derive(Serialize, Deserialize)]
|
|
pub enum MoveType {
|
|
Quiet,
|
|
Capture,
|
|
Castle,
|
|
EnPassant,
|
|
}
|
|
|
|
impl MoveType {
|
|
pub(in super) fn from_bitmovetype(move_type: BitMoveType) -> Self {
|
|
return match move_type {
|
|
BitMoveType::Quiet => Self::Quiet,
|
|
BitMoveType::Capture => Self::Capture,
|
|
BitMoveType::Castle => Self::Castle,
|
|
BitMoveType::EnPassant => Self::EnPassant,
|
|
_ => panic!("invalid move_type index! should NEVER appear")
|
|
}
|
|
}
|
|
pub(in super) fn to_bitmoveType(&self) -> BitMoveType {
|
|
return match self {
|
|
&MoveType::Quiet => BitMoveType::Quiet,
|
|
&MoveType::Capture => BitMoveType::Capture,
|
|
&MoveType::Castle => BitMoveType::Castle,
|
|
&MoveType::EnPassant => BitMoveType::EnPassant
|
|
};
|
|
}
|
|
} |