/// <summary>Creates a path based on the position and the velocity of the ball.</summary>
        public static BallPath Create(Position ball, Velocity velocity, int pickUpTimer, int maxLength)
        {
            var path = new BallPath()
            {
                PickUpTimer = pickUpTimer
            };

            var pos = ball;
            var vel = velocity;

            for (var turn = 0; turn < maxLength; turn++)
            {
                path.Add(pos);
                pos += vel;
                vel *= Accelaration;

                if (Game.Field.IsLeft(pos))
                {
                    vel = vel.FlipHorizontal;
                    var prev = turn == 0 ? ball : path[turn - 1];
                    if (prev.Y > Goal.MinimumY && pos.Y < Goal.MaximumY &&
                        prev.Y > Goal.MinimumY && pos.Y < Goal.MaximumY)
                    {
                        path.End = Ending.GoalOwn;
                        return(path);
                    }
                    path.Bounces++;
                    var dX = Game.Field.MinimumX - pos.X;
                    pos = new Position(Game.Field.MinimumX + dX, pos.Y);
                }
                else if (Game.Field.IsRight(pos))
                {
                    vel = vel.FlipHorizontal;
                    var prev = turn == 0 ? ball : path[turn - 1];
                    if (prev.Y > Goal.MinimumY && pos.Y < Goal.MaximumY &&
                        prev.Y > Goal.MinimumY && pos.Y < Goal.MaximumY)
                    {
                        path.End = Ending.GoalOther;
                        return(path);
                    }
                    path.Bounces++;
                    var dX = Game.Field.MaximumX - pos.X;
                    pos = new Position(Game.Field.MaximumX + dX, pos.Y);
                }
                if (Game.Field.IsAbove(pos))
                {
                    path.Bounces++;
                    vel = vel.FlipVertical;
                    var dY = Game.Field.MinimumY - pos.Y;
                    pos = new Position(pos.X, Game.Field.MinimumY + dY);
                }
                if (Game.Field.IsUnder(pos))
                {
                    path.Bounces++;
                    vel = vel.FlipVertical;
                    var dY = Game.Field.MaximumY - pos.Y;
                    pos = new Position(pos.X, Game.Field.MaximumY + dY);
                }
            }
            return(path);
        }