Example #1
0
 public override string ToString()
 {
     return(string.Format("{0}x{1}{2}e.p.{3}", MoveUtilities.GetFileFromInt(StartingSquare.Coordinate.File),
                          MoveUtilities.GetFileFromInt(EndingSquare.Coordinate.File),
                          EndingSquare.Coordinate.Rank,
                          GetCheckNotation()));
 }
Example #2
0
        protected string GetPieceNotation()
        {
            var startingFile = MoveUtilities.GetFileFromInt(StartingSquare.Coordinate.File);

            return(MovedPiece is Pawn && IsCapture
                ? startingFile
                : MovedPiece.GetNotation());
        }
Example #3
0
        public SquareCoordinate(int rank, int file)
        {
            if (!MoveUtilities.IsValidPosition(rank, file))
            {
                throw new ArgumentException();
            }

            File = file;
            Rank = rank;
        }
Example #4
0
        private bool GetIsValidCastleMove(Board board, Square startingSquare, Square endingSquare, out CastleType?castleType, out King king)
        {
            castleType = null;

            king = startingSquare.Piece as King;
            if (king == null)
            {
                return(false);
            }

            return(IsCastleMove(king, startingSquare, endingSquare, out castleType) &&
                   MoveUtilities.CanCastle(king, board, castleType.Value));
        }
Example #5
0
 protected string GetDisambiguating()
 {
     if (_ambiguousMoveStartingSquare == null)
     {
         return(String.Empty);
     }
     else if (_ambiguousMoveStartingSquare.Coordinate.File == StartingSquare.Coordinate.File)
     {
         return(StartingSquare.Coordinate.Rank.ToString());
     }
     else
     {
         return(MoveUtilities.GetFileFromInt(StartingSquare.Coordinate.File));
     }
 }
Example #6
0
        public override string ToString()
        {
            var piece          = GetPieceNotation();
            var endingFile     = MoveUtilities.GetFileFromInt(EndingSquare.Coordinate.File);
            var rank           = EndingSquare.Coordinate.Rank;
            var isCapture      = GetCaptureNotation(IsCapture);
            var check          = GetCheckNotation();
            var disambiguating = GetDisambiguating();

            return(string.Format("{0}{1}{2}{3}{4}{5}", piece,
                                 disambiguating,
                                 isCapture,
                                 endingFile,
                                 rank,
                                 check));
        }
Example #7
0
 protected override IEnumerable <SquareCoordinate> GetNewControlledSquares(Board board)
 {
     return(MoveUtilities.GetLineAvailability(CurrentSquare.Coordinate, board, Color, SquareInfluenceType.Control));
 }
Example #8
0
 internal IEnumerable <SquareCoordinate> GetFrontSquares()
 {
     return(MoveUtilities.GetPawnFrontSquares(CurrentSquare.Coordinate, Color));
 }
Example #9
0
 protected override IEnumerable <SquareCoordinate> GetAvailableMoves(Board board)
 {
     return(MoveUtilities.GetPawnAvailability(CurrentSquare.Coordinate, board, Color, SquareInfluenceType.Mobility));
 }
Example #10
0
        public override string ToString()
        {
            var file = MoveUtilities.GetFileFromInt(File);

            return(file.ToString() + Rank);
        }
Example #11
0
 public override bool IsPieceMove(Square startingSquare, Square endingSquare, Piece capturedPiece)
 {
     return(MoveUtilities.IsKingValidMove(startingSquare.Coordinate, endingSquare.Coordinate));
 }