Function cozy_chess::util::parse_uci_move
source · pub fn parse_uci_move(board: &Board, mv: &str) -> Result<Move, MoveParseError>
Expand description
Parses a UCI move into a Move
.
This differs from Move
’s FromStr
implementation in that
it converts the standard UCI castling notation to the king-captures-rook
notation that cozy-chess
uses (e.g. e1g1
parses as e1h1
).
§Examples
let board: Board = "rnbqkb1r/ppp2ppp/4pn2/3p4/8/5NP1/PPPPPPBP/RNBQK2R w KQkq - 0 4"
.parse().unwrap();
assert_eq!(
parse_uci_move(&board, "e1g1").unwrap(),
"e1h1".parse::<Move>().unwrap()
);