Chess.Data.Piece.Knight.IsLegalMove C# (CSharp) Méthode

IsLegalMove() public méthode

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

            if (!InBounds(move.EndRow, move.EndColumn))
                throw new Exception("You have moved out of bounds!");
            if (!IsValidKnightMove(move)) //L-movement
                throw new Exception("You may only move in a proper 'L' pattern for a knight.");

            return true;
        }