Jump to content
  • Advertisement
Sign in to follow this  
Guest

reversing a progression

This topic is 4149 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest
Let's say I have
x(i) = x(i-1) * 2 + 50
x0 =   0          =   0
x1 =   0 * 2 + 50 =  50
x2 =  50 * 2 + 50 = 150
x3 = 150 * 2 + 50 = 350
x4 = 350 * 2 + 50 = 750
If I have a "score" = 175, what is the formula to give me the index of the immediate lower term, ie. 2? I need this to compute the "rank" of a player, depending on the score. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Guest
Thank you for the quick reply, I've already put it in practice [smile]

Share this post


Link to post
Share on other sites
That's all good and well provided you can write the formula in a closed form, but if the recurrence-relation isn't so simple, you'll just have to hope and pray that you can rearrange it, like:

x(i) = x(i-1) * 2 + 50
x(i) - 50 = x(i-1)
(x(i) - 50) / 2 = x(i-1)

so

x(i) = (x(i+1) - 50) / 2

This way you can throw the current score in and get the preceding value out, without having to invert or look-up.

Admiral

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!