Chess.Data.Piece.Bishop.IsLegalMove C# (CSharp) Method

IsLegalMove() public method

public IsLegalMove ( Square board, Move move, IEnumerable pastMoves = null ) : bool
board Chess.Data.Entities.Square
move Chess.Data.Entities.Move
pastMoves IEnumerable
return bool
        public override bool IsLegalMove(Square[][] board, Move move, IEnumerable<Move> pastMoves = null)
        {
            ValidateNotAttackingSameTeam(board, move);

            if (Math.Abs(move.RowChange) != Math.Abs(move.ColumnChange))
                throw new Exception("You may only move diagonally with a bishop.");
            if (HasCollision(board, move))
                throw new Exception("There is a piece between your bishop and your destination!");

            return true;
        }