private static string ToRan(Move move, IPosition pos) { var from = move.GetFromSquare(); var to = move.GetToSquare(); var notation = new StringBuilder(12); if (move.IsCastlelingMove()) { notation.Append(ECastlelingExtensions.GetCastlelingString(to, from)); } else { var pt = move.GetMovingPieceType(); if (pt != EPieceType.Pawn) { notation.Append(pt.GetPieceChar()); } notation.Append(from.ToString()); if (move.IsEnPassantMove()) { notation.Append("ep"); notation.Append(from.FileChar()); } else if (move.IsCaptureMove()) { if (pt == EPieceType.Pawn) { notation.Append(from.FileChar()); } notation.Append('x'); notation.Append(move.GetCapturedPiece().Type().GetPieceChar()); } else { notation.Append('-'); } notation.Append(to.ToString()); if (move.IsPromotionMove()) { notation.Append('='); notation.Append(move.GetPromotedPiece().GetUnicodeChar()); } } if (pos.InCheck) { notation.Append(pos.GetCheckChar()); } return(notation.ToString()); }