Ejemplo n.º 1
0
        private string FormatEnPassant(EnPassantMove move, IChessPieceFormatter pieceFormatter)
        {
            string pieceStr = pieceFormatter.FormatPiece(Pieces.PieceType.Pawn);

            return(pieceStr
                   + move.AttackingPawn.Position.ToString() + " x "
                   + move.DestinationPosition.ToString() + "e.p.");
        }
Ejemplo n.º 2
0
        private string FormatNormalMove(NormalPieceMove move, IChessPieceFormatter pieceFormatter)
        {
            string pieceStr = pieceFormatter.FormatPiece(move.Piece.Type);

            return(pieceStr
                   + move.OldPosition.ToString() + " "
                   + (move.PieceCaptured ? "x " : "")
                   + move.NewPosition.ToString());
        }
Ejemplo n.º 3
0
        private string FormatPromotion(PromotionMove move, IChessPieceFormatter pieceFormatter)
        {
            string promotingPiece = pieceFormatter.FormatPiece(Pieces.PieceType.Pawn);
            string newPiece       = pieceFormatter.FormatPiece(move.NewPieceType.Type);

            return(promotingPiece +
                   move.OldPosition.ToString() +
                   (move.PieceCaptured ? " x " : " ") +
                   move.NewPosition.ToString() + " = " +
                   newPiece);
        }
Ejemplo n.º 4
0
        public string FormatMove(Move move, IChessPieceFormatter pieceFormatter)
        {
            switch (move.Type)
            {
            case MoveType.NormalPiece:
                return(FormatNormalMove(move.NormalPieceMove, pieceFormatter));

            case MoveType.Castle:
                return(FormatCastle(move.Castle, pieceFormatter));

            case MoveType.EnPassant:
                return(FormatEnPassant(move.EnPassant, pieceFormatter));

            case MoveType.Promotion:
                return(FormatPromotion(move.Promotion, pieceFormatter));

            default:
                throw new AlienChessException();
            }
        }
Ejemplo n.º 5
0
 private string FormatCastle(CastleMove move, IChessPieceFormatter pieceFormatter)
 {
     return(move.Type == CastleMoveType.KingSide ? "OO" : "OOO");
 }