implemented constructor for enum MoveType from in-engine move_type index

This commit is contained in:
Varga Dávid Lajos
2025-11-21 12:40:24 +01:00
parent 23c890f329
commit 82a6bd8449

View File

@@ -9,3 +9,14 @@ pub enum MoveType {
EnPassant,
}
impl MoveType {
pub fn from_index(idx: u8) -> Self {
return match idx {
0 => Self::Quiet,
1 => Self::Capture,
2 => Self::Castle,
3 => Self::EnPassant,
_ => panic!("invalid move_type index! should NEVER appear")
}
}
}