Make more readability refactorings
This commit is contained in:
@@ -12,7 +12,7 @@ pub fn from_fen(fen: &str) -> Result<Game, FenError> {
|
||||
|
||||
let castling_ability = castling_ability(fen_parts[2])?;
|
||||
|
||||
let en_passant_target_square = en_passant_target_square(fen_parts[3])?;
|
||||
let en_passant_square = en_passant_square(fen_parts[3])?;
|
||||
|
||||
let halfmove_clock = halfmove_clock(fen_parts[4])?;
|
||||
|
||||
@@ -21,7 +21,7 @@ pub fn from_fen(fen: &str) -> Result<Game, FenError> {
|
||||
board.set_state(State::load_state(
|
||||
side_to_move,
|
||||
castling_ability,
|
||||
en_passant_target_square,
|
||||
en_passant_square,
|
||||
halfmove_clock,
|
||||
fullmove_counter,
|
||||
));
|
||||
@@ -123,7 +123,7 @@ fn castling_ability(castling: &str) -> Result<[Castle; 2], FenError> {
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
fn en_passant_target_square(square: &str) -> Result<Option<usize>, FenError> {
|
||||
fn en_passant_square(square: &str) -> Result<Option<usize>, FenError> {
|
||||
let mut sqr = square.chars();
|
||||
|
||||
let mut files: HashMap<char, usize> = HashMap::new();
|
||||
|
||||
Reference in New Issue
Block a user