changed method from_index for enum MoveType to from_bitmovetype

This commit is contained in:
Varga Dávid Lajos
2025-11-21 12:55:18 +01:00
parent 82a6bd8449
commit 5e65bcf5ef
2 changed files with 9 additions and 8 deletions

View File

@@ -3,8 +3,8 @@ mod utils;
mod legality;
mod checkinfo;
mod attacks;
mod bitmove;
mod movebuffer;
mod movegen;
pub mod board;
pub mod board;
pub(in super) mod bitmove;

View File

@@ -1,5 +1,6 @@
use serde::Deserialize;
use serde::Serialize;
use super::bitboard::bitmove::BitMoveType;
#[derive(Serialize, Deserialize)]
pub enum MoveType {
@@ -10,12 +11,12 @@ pub enum MoveType {
}
impl MoveType {
pub fn from_index(idx: u8) -> Self {
return match idx {
0 => Self::Quiet,
1 => Self::Capture,
2 => Self::Castle,
3 => Self::EnPassant,
pub 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")
}
}