public string ToAlgebraic(Board board, NotationModifiers notationModifier) { string algebraic; if (Modifier == MoveModifiers.KingSideCastle) { algebraic = "O-O"; } else if (Modifier == MoveModifiers.QueenSideCastle) { algebraic = "O-O-O"; } else { string movedPieceName = MovedPieceName(board); algebraic = SquareName(ToSquare); if (CapturedPiece == Pieces.None) { if (!Pieces.IsPawn(MovedPiece)) { algebraic = movedPieceName + algebraic; } } else { algebraic = "x" + algebraic; if (Pieces.IsPawn(MovedPiece)) { algebraic = FileName(FromSquare) + algebraic; } else { algebraic = movedPieceName + algebraic; } } if (Modifier == MoveModifiers.EnPassant) { // This appended notation doesn't seem to be used by many people. //algebraic += " e.p."; } if (PromotionPiece != Pieces.None) { algebraic += "=" + Pieces.ToFEN(PromotionPiece).ToUpper(); } } algebraic += NotationModifierMap[notationModifier]; return(algebraic); }
public string ToAlgebraic(NotationModifiers notationModifier) { return(ToAlgebraic(null, notationModifier)); }