Example #1
0
        internal static IEnumerable <SquareCoordinate> GetAllInBetweenSquares(this SquareCoordinate startingCoordinate, SquareCoordinate endingCoordinate)
        {
            var ret = new List <SquareCoordinate>();

            if (startingCoordinate.IsOnDiagonal(endingCoordinate))
            {
                Extensions.AddRange(ret, GetDiagonalInBetweenPositions(startingCoordinate, endingCoordinate));
            }
            if (startingCoordinate.IsOnRankOrFile(endingCoordinate))
            {
                Extensions.AddRange(ret, GetStraightInBetweenPosition(startingCoordinate, endingCoordinate));
            }

            return(ret);
        }
Example #2
0
 internal static bool IsOnRankFileOrDiagonal(this SquareCoordinate startingCoordinate, SquareCoordinate endingCoordinate)
 {
     return(startingCoordinate.IsOnRankOrFile(endingCoordinate) ||
            startingCoordinate.IsOnDiagonal(endingCoordinate));
 }