ChessDotNet.Piece.GetValidMoves C# (CSharp) Method

GetValidMoves() public abstract method

public abstract GetValidMoves ( Position from, bool returnIfAny, ChessGame game, bool>.Func gameMoveValidator ) : ReadOnlyCollection
from Position
returnIfAny bool
game ChessGame
gameMoveValidator bool>.Func
return ReadOnlyCollection
        public abstract ReadOnlyCollection<Move> GetValidMoves(Position from, bool returnIfAny, ChessGame game, Func<Move, bool> gameMoveValidator);
    }

Usage Example

Example #1
0
        protected virtual ReadOnlyCollection <Move> GetValidMoves(Position from, bool returnIfAny)
        {
            ChessUtilities.ThrowIfNull(from, "from");
            Piece piece = GetPieceAt(from);

            if (piece == null || piece.Owner != WhoseTurn)
            {
                return(new ReadOnlyCollection <Move>(new List <Move>()));
            }
            return(piece.GetValidMoves(from, returnIfAny, this, IsValidMove));
        }