use super::*;
pub mod fen;
pub mod moves;
pub mod pgn;
pub fn symbol_to_piece(symbol: char) -> Result<usize, String> {
match symbol {
'p' | 'P' => Ok(PAWN),
'n' | 'N' => Ok(KNIGHT),
'b' | 'B' => Ok(BISHOP),
'r' | 'R' => Ok(ROOK),
'q' | 'Q' => Ok(QUEEN),
'k' | 'K' => Ok(KING),
_ => Err(format!("Invalid parameter: symbol={}", symbol)),
}
}
pub fn piece_to_symbol(piece: usize) -> Result<char, String> {
match piece {
PAWN => Ok('P'),
KNIGHT => Ok('N'),
BISHOP => Ok('B'),
ROOK => Ok('R'),
QUEEN => Ok('Q'),
KING => Ok('K'),
_ => Err(format!("Invalid parameter: piece={}", piece)),
}
}