Function cozy_chess::util::display_san_move
source · pub fn display_san_move(board: &Board, mv: Move) -> impl Display
Expand description
Returns an object that allows printing a Move
in Standard Algebraic Notation.
§Panics
This is guaranteed to panic if the move is illegal.
§Examples
let board: Board = "3k2n1/7P/Q3p3/4BPp1/Q1Q4q/8/5B2/R3K2R w KQ g6 0 1"
.parse().unwrap();
let mv: Move = "h7g8r".parse().unwrap();
assert_eq!(format!("{}", display_san_move(&board, mv)), "hxg8=R+");
let mv: Move = "e1a1".parse().unwrap();
assert_eq!(format!("{}", display_san_move(&board, mv)), "O-O-O+");
let mv: Move = "e5d4".parse().unwrap();
assert_eq!(format!("{}", display_san_move(&board, mv)), "Bd4");