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.

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

That looks good. At about 2km, scores start to get quite low (25) and by \(\sim\)4km the user will get almost no points. That’s pretty reasonable for a city the size of Belo Horizonte, but if you take a really small city, getting 25 points for a 2km distance might be just too much. So let’s adjust the score based on the size of the city.

Suppose \(A_{\mbox{bh}}\) is Belo Horizonte’s area, we can create a coefficient \(\alpha=A_{\mbox{city}}/A_{\mbox{bh}}\). As the value of \(\alpha\) decreases, less points should be awarded to the user and more points should be awarded if otherwise. So, the same way we did for easiness \(e\), we also divide \(d\) by this coefficient, but since it represents an area (which follows the square cube law), we take it’s square root first. Which leads us to:

\[S = \frac{100}{1 + \left(\frac{d}{e\sqrt{\alpha}}\right)^4}\]

For a city the size of Barcelona, for example, with \(\alpha \approx 0.5\) we get:

## Share on Social Media