Calculate score in a game based on time passed I'm creating a game which would give the player points based on time they needed to solve a puzzle. The faster they complete it, the more points they get. I need a formula which would calculate such score. "t" should be the total completion time in seconds, "x" should define the decrease in points per second. The base score should be 10000 and decrease gradually to 0. Thanks in advance.
 A: Use the specification:

*

*$f(t) = 0 ~: t \geq 7200.$


*Else,  $~\displaystyle f(t) = \frac{10000}{10000^{(t/7200)}}.$
Then,
$$f(0) = \frac{10000}{10000^{(0)}}  = \frac{10000}{1}$$
and, as $(t)$ approaches $(7200)$, $f(t)$ will approach
$$\frac{10000}{10000^{\left(\frac{7200}{7200}\right)}} = \frac{10000}{10000^{(1)}} = 1.$$

Addendum
As Brian Tung indicated in the comment following this answer, the function is not continuous, as $t$ approaches $7200$.
A more complicated version of the function, which would provide continuity is

*

*$f(t) = 0 ~: t \geq 7200.$


*Else,  $~\displaystyle f(t) = -1 + \frac{10001}{10001^{(t/7200)}}.$
Then,
$$f(0) = -1 + \frac{10001}{10001^{(0)}}  = -1 + \frac{10001}{1}$$
and, as $(t)$ approaches $(7200)$, $f(t)$ will approach
$$-1 + \frac{10001}{10001^{\left(\frac{7200}{7200}\right)}} = -1 + \frac{10001}{10001^{(1)}} = 0.$$
A: Just to give you another choice (and expanding on my comment), a parabola has the nice feature that the decrement will fall off linearly over time. We want a parabola that starts at $10000$ at $t = 0$, then drops off and skims to the $x$ axis at $t = T$, where $T$ is the time limit. The expression is
$$
f(t) = \begin{cases}
\frac{10000(T-t)^2}{T^2} & 0 \leq t \leq 7200 \\
0 & t > 7200
\end{cases}
$$
For example, for $T = 7200$, as given in your comment, we have a plot that looks like this:

Either a linear falloff (as here) or an exponential falloff (as in user2661923's answer) is a reasonable choice. There are, of course, (infinitely) many others, but simplicity is key. :-)
