상속: Piece
예제 #1
0
        public override Piece AsPromotion()
        {
            var copy = new Bishop(Owner);

            copy.IsPromotionResult = true;
            return(copy);
        }
예제 #2
0
 public override ReadOnlyCollection<Move> GetValidMoves(Position from, bool returnIfAny, ChessGame game, Func<Move, bool> gameMoveValidator)
 {
     ChessUtilities.ThrowIfNull(from, "from");
     ReadOnlyCollection<Move> horizontalVerticalMoves = new Rook(Owner).GetValidMoves(from, returnIfAny, game, gameMoveValidator);
     if (returnIfAny && horizontalVerticalMoves.Count > 0)
         return horizontalVerticalMoves;
     ReadOnlyCollection<Move> diagonalMoves = new Bishop(Owner).GetValidMoves(from, returnIfAny, game, gameMoveValidator);
     return new ReadOnlyCollection<Move>(horizontalVerticalMoves.Concat(diagonalMoves).ToList());
 }
예제 #3
0
        public override ReadOnlyCollection <Move> GetValidMoves(Position from, bool returnIfAny, ChessGame game, Func <Move, bool> gameMoveValidator)
        {
            ChessUtilities.ThrowIfNull(from, nameof(from));
            ReadOnlyCollection <Move> horizontalVerticalMoves = new Rook(Owner).GetValidMoves(from, returnIfAny, game, gameMoveValidator);

            if (returnIfAny && horizontalVerticalMoves.Count > 0)
            {
                return(horizontalVerticalMoves);
            }
            ReadOnlyCollection <Move> diagonalMoves = new Bishop(Owner).GetValidMoves(from, returnIfAny, game, gameMoveValidator);

            return(new ReadOnlyCollection <Move>(horizontalVerticalMoves.Concat(diagonalMoves).ToList()));
        }
예제 #4
0
파일: Queen.cs 프로젝트: asibahi/Chess.NET
        public override ReadOnlyCollection <Move> GetValidMoves(Square from, bool returnIfAny, ChessGame game)
        {
            ChessUtilities.ThrowIfNull(from, nameof(from));

            var horizontalVerticalMoves = new Rook(Owner).GetValidMoves(from, returnIfAny, game);

            if (returnIfAny && horizontalVerticalMoves.Count > 0)
            {
                return(horizontalVerticalMoves);
            }

            var diagonalMoves = new Bishop(Owner).GetValidMoves(from, returnIfAny, game);

            return(new ReadOnlyCollection <Move>(horizontalVerticalMoves.Concat(diagonalMoves).ToList()));
        }