3
$\begingroup$

I am a programmer, not a mathematician and I'm trying to solve a problem for scoring in my game. Please excuse my weak maths and lack of mathematical syntax, and sorry if this question has been asked before.

Let's say we have a game level which consists of 4 stages. As the players moves from stage to stage, the required score for each stage increases. Let's say the overall score for the level is 1000 and I want the last stage to require 4 times more score.

Let these be the variables:

  • $y$ is level total required score.
  • $n_1, n_2, n_3, n_4$ are 4 stages in level.
  • $x$ is the score requirement multiplier for the last stage ($d$).

So to represent as an equation:

$n_1 + n_2 + n_3 + n_4 = y$ where $n_4 = x \times n_1$

therefore based on the values in my example the equation would be:

$n_1 + n_2 + n_3 + 4n_1 = 1000$

How do I solve for $n_1$ , $n_2$ and $n_3$ such that there is a progression in the score requirement from stage to stage?


For some reason this formula works, substituting for the variables:

$n_1 + \frac {4n_1}{3} + \frac {4n_1}{2} + 4n_1 = 1000$

I able to solve for $n_1$ and I get $n_1 = 120$.

This answer checks out:

$120 + \frac {4 \times 120}{3} + \frac {4 \times 120}{2} + (4 \times 120) = 1000$

$120 + 160 + 240 + 480 = 1000$

But I don't understand how that works. Where do the denominators for the fractions $\frac 43$ and $\frac 42$ come from?

Anyone that could shed some light on how to solve this, your time would be appreciated :)

$\endgroup$
2
  • 3
    $\begingroup$ It looks like a geometric sum. You're starting with 120. Then you add 40, and then $2\times 40$ and then $2^2 \times 40 ...$ So you're basically calculating $$ 120 + 40 \sum_{k=0}^n 2^k $$ $\endgroup$
    – Matti P.
    Nov 21, 2018 at 9:18
  • $\begingroup$ Thanks @MattiP. I wish I could read that formula... :) I think I understand the gist of it. $\endgroup$
    – jnt
    Nov 21, 2018 at 9:36

1 Answer 1

3
$\begingroup$

This question is a little difficult to answer mathematically, since $a+b+c+xa=1000$ has many possible solutions. So let's refine it a little bit. Let's add a requirement that each stage costs $r$ times as much as the previous stage. We can then rewrite the equation as $$a+ar+ar^2+ar^3=1000.$$ At this point, you can just pick your favorite value of $r$ and solve for $a$. If you want each stage to cost $2$ times as much as the previous stage then $$a+2a+4a+8a=1000$$ $$15a=1000$$ $$a=\frac{200}3 \approx 67.$$ This gives the value of the first stage, and then $2a, 4a,$ and $8a$ are the values of the stages afterward.

$\endgroup$
1
  • $\begingroup$ That makes much more sense - to define the progression amount, not the final multiple. Which means my starting point was wrong, making this really hard to solve. Thanks so much for your answer :) $\endgroup$
    – jnt
    Nov 21, 2018 at 9:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .