public static IEnumerable <Position> RepeatMove(this Position StartPosition, Func <Position, Position> ChangePosition)
        {
            //Struct -> pass by value, creates copy
            Position copyPosition = StartPosition;

            while (copyPosition.IsOnBoard())
            {
                Position nextMove = ChangePosition(copyPosition);
                yield return(nextMove);

                copyPosition = nextMove;
            }
        }
        private Position[] AddCollisionPawn(ChessPiece CurrentPiece)
        {
            Position[]      allTurns = CurrentPiece.PossibleTurns().SelectMany(x => x).ToArray();
            List <Position> Builder  = new List <Position>();

            if (allTurns.Length == 0)
            {
                // Change to any piece except pawn and king
            }
            else
            {
                //Check forward, left forward, right forward

                foreach (Position forwardDirection in allTurns)
                {
                    if (this[forwardDirection] == null)
                    {
                        Builder.Add(forwardDirection);
                    }
                    else
                    {
                        break;
                    }
                }

                Position forward = allTurns[0];


                //If there're pieces right or left corners, take them.
                Position ForwardLeft = forward.ToLeft(CurrentPiece.Color);
                if (ForwardLeft.IsOnBoard())
                {
                    ChessPiece PieceForwardLeft = this[ForwardLeft];
                    if (PieceForwardLeft != null && PieceForwardLeft.Color != CurrentPiece.Color)
                    {
                        Builder.Add(ForwardLeft);
                    }
                }

                Position ForwardRight = forward.ToRight(CurrentPiece.Color);
                if (ForwardRight.IsOnBoard())
                {
                    ChessPiece PieceForwardRight = this[ForwardRight];
                    if (PieceForwardRight != null && PieceForwardRight.Color != CurrentPiece.Color)
                    {
                        Builder.Add(ForwardRight);
                    }
                }
            }
            return(Builder.ToArray());
        }
        public static IEnumerable <Position> RepeatMove(this Position StartPosition, Func <Position, Position> ChangePosition, int HowManyTimes)
        {
            //Struct -> pass by value, creates copy
            Position copyPosition = StartPosition;

            for (int i = 0; i < HowManyTimes; i++)
            {
                if (copyPosition.IsOnBoard())
                {
                    Position nextMove = ChangePosition(copyPosition);
                    yield return(nextMove);

                    copyPosition = nextMove;
                }
            }
        }