I need to translate a mechanic from my game into an algebraic expression in a spreadsheet.

39 Views Asked by At

I'm writing a board game, and in this board game your Stats get more expensive as they increase. What I need to do is write a formula that calculates a stat's Cost on the game's character sheet (which, for now, uses Google Sheets).

Stats are measured in pips. Increasing a Stat (Stat = S) by 1 pip costs 1 point, plus an amount of points equal to the Tier (Tier = T) of the Stat.

Every 3 pips you have in a Stat, after 10 pips, will grant you +1 to your Tier for that Stat. The minimum value a Tier can be is 0. Formula: T=(S-10)/3 (or 0 if T would be a negative number.)

For the life of me, I can't figure out a formula actually works. The math isn't that hard to do manually, basically just repetitive addition. A friend and I made a chart for it as we were testing things out, which we've been using as a comparison for the formulas we've tried. I'm not very well-practiced in algebra, and have not been successful in creating a formula, does anyone have an idea?

1

There are 1 best solutions below

0
On

I translate your description into the following equations: \begin{eqnarray} T(S) &=& \lfloor \frac{S - 10}3\rfloor\\ P(S + 1) &=& P(S) + 1 + T(S)\\ P(10) &=& 0 \end{eqnarray} and what you want is a formula for $P(S)$.

It turns out that the formula for $P(S)$ is given by $$P(10 + 3t + r) = \frac{3t(t + 1)}2 + r(t + 1)$$ for $r = 0, 1, 2$.

This can be easily proved by induction on $t$, or by observing that $P(S) = P(S - 3) + S - 10$ for any $S \geq 13$.