diff --git a/src/lib.rs b/src/lib.rs index 95347d3..7b92312 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,7 @@ use colored::Colorize; use shakmaty::san::ParseSanError; use shakmaty::san::San; use shakmaty::san::SanError; +use shakmaty::uci::Uci; use shakmaty::{Chess, Color, IllegalMoveError, Position, Setup, Square}; use std::fmt; use std::io; @@ -168,8 +169,11 @@ fn board_string_representation(chess: &Chess, side: Color) -> Vec Result { - let san: San = movestr.parse()?; - let mv = san.to_move(chess)?; + //if uci parse error, try to parse with san. + let mv = match movestr.parse::() { + Ok(uci) => uci.to_move(chess)?, + Err(_) => movestr.parse::()?.to_move(chess)?, + }; Ok((*chess).clone().play(&mv)?) }