# Introduction

We need a formula that, given the distance of the player’s answer and the point shown, returns a score from 0 to 100 that (ideally) reflects the user’s knowledge of the city.

We start with the premise that, if the user is really close to the right place, he should not be penalized a lot. In the same sense, it gets to a point that if his answer is far away or even farther way, there’s little difference in his knowledge of the place.

For example, if an answer is 10 or 20 meters away from the right place, the player should get very similar scores. And if the answer is 3000 meters of 3500 meters away he should also get very similar scores, even thought the same difference of 500 meters in the other situation would make a huge difference.

# The function

So we come up with the following bell-curve-like function, where $$S$$ is the score and $$d$$ the distance in km between the right place and the player’s answer:

$S = \frac{100}{1+{d^4}}$

Ok, that works pretty well, but let’s increment it slightly. Let’s stretch the curve by dividing $$d$$ by a factor of easiness $$e$$. The higher the value of $$e$$, the more the curve is stretched and the more points the player gets. The formula is now:

$S = \frac{100}{1 + \left(\frac{d}{e}\right)^4}$

With $$e = 1.5$$ we get