Algorithm for awarding prizes on a leaderboard


If you have a prize pool (say 1,000 points), and a leaderboard like:

Rank / Name
1 / Dan
2 / Rachel
3 / Max
4 / Chloe
5 / Grant

Is there an algorithm where you can input prize pool, rank, and maybe the number of people, and it will give you the number of points (or a %) for each rank. The person ranked #1 would get like 25% of the prize pool, and each person below would get less and less until the full prize pool is paid out.

Possible? Ideas?


yep that’s easily done.

all you need is the breakdown for awarding the number points to each ranking and some basic primary school arithmetic.

Maybe I wasn’t clear – there is no breakdown, that’s what I want to calculate.

Someone on IRC helped me with this formula (which I converted to Excel for testing):

((1 - p) / (1 - p ^ n) * p ^ (r - 1)) * l

p = a value between 0 and 1 which defines the distribution (sort of).
n = number of players
r = rank
l = prize pool


what does the number that formula outputs represent?

unless you have some sort of criteria in your head on how to distribute the pool amongst the rankings, you can use any formula you like to do the distribution.

It represents the prize awarded to a particular player.

It depends on what you mean by “any formula” – it has to distribute the whole prize pool.


ok, so you said 25% went to ranking 1.

what percentages do you want to allocate to the other rankings?

25% wasn’t a hard rule, I just wanted to make sure the prizes weren’t too “top-heavy”.

I think the formula I have now might be what I need.

ok, so in that formula will the value of p be constant for all rankings or will it vary from ranking to ranking?

It will be constant.

ok, that makes it easy.

in that case only the value of r will vary in your formula.

so all you need to do is set up a FOR loop going from 1 to the number of rankings and then use the current value of your for loop counter as the value of r to calculate the pool distribution for that ranking. all the other parameters in your formula are constants.

Yep, the coding part is easy, it was the mathematics that I was struggling with. :smiley:

glad you sorted it out in the end :slight_smile:

I appreciate your help. :slight_smile: