How to use the properties of the logarithmic function

57 Views Asked by At

I'm coding the game asteroids. I want to make a levels manager who can create a infinity number of level increasing in difficulty.

My levels have as parameters :

  • The number of asteroids on the board;
  • The average radius of the asteroids on the board;
  • The minimum radius an asteroid has to have to exists.

However, I can't use a linear function to calculate the parameters in function on the level because each parameter has their restrictions.

  • The number of asteroids on the board increase from $2$ to a maximum of $20$.
  • The average radius of the asteroids increase from $30$ to a maximum of $50$.
  • The minimum radius of the asteroids decrease from $15$ to a minimum of $5$.

How can I use the properties of the logarithmic function to be able to generate a minimum of $100$ level?

Thanks for your help.

2

There are 2 best solutions below

1
On

Let $N$ represent the maximum level number

The quantities for level $x$ could be ...

Number of Asteroids $$N(x) = 2 + 18 \frac{\log x}{\log N} $$ Average Radius $$A(x) = 30 + 20 \frac{\log x}{\log N} $$

Minimum Radius $$M(x) = 15 -10\frac{\log x}{\log N} $$

0
On

Finally, I use this method : $$f(l):=m\left( \frac{m}{M} \right)^{\frac{l-1}{1-N}}$$

I calculate it by resolving the ODE : $$\frac{d}{dl}f(l)=kf(l)$$

with $f(1)=m$ and $f(N)=N$.