Exemplo n.º 1
0
        public static MoveSummary CanKnightMove(Board board, Square from, Square to)
        {
            var isSameColor = board[from].Color == board[to].Color;
            var isCapturing = board[to].IsNone() ?
                              false :
                              !isSameColor;
            var isMovePossible =
                !isSameColor &&
                MoveProperty.AbsDeltaX(from, to) *
                MoveProperty.AbsDeltaY(from, to) == 2;

            return(MoveSummaryBuilder.DefaultMoveSummary(isCapturing, isMovePossible, to));
        }
Exemplo n.º 2
0
 private static bool CanDefaultMove(Square from, Square to, bool isSameColor) =>
 !isSameColor &&
 MoveProperty.AbsDeltaX(from, to) <= 1 &&
 MoveProperty.AbsDeltaY(from, to) <= 1;