I'm trying to find the math to calculate prize (money/points) distribution based on some key criteria.

I will be coding the final solution using either C++, not that this is important but the translating to code is a bit.

The prize distribution needs to be logically curved so that 1st gets higher than 2nd etc.

I have shown how I tried to do it however it wasn't scaling due to rounding and having too large a remainder to distribute fairly.

Therefore I feel removing the percentage requirements and grouping, perhaps I can bed it down with simpler rules.

The main variables are...

Total_Entrants (25-100).

Entry_Fee (Whole Number).

Prize_Pool = (Total_Entrants x Entry_Fee) - 10%

Winners - Prize_Pool to be distributed to top 50% with remainder going to 1st (if required).

- Winners is rounded up if an odd number. Bottom 50% get nothing.

---------------------------------------------

Previously I have tried basing it on grouping Total_Entrants like so...

1-10% get 50% of Prize_Pool

11-20% get 2% of Prize_Pool

21-30% get 1.5% of Prize_Pool

31-40% get 1% of Prize_Pool

41-50% get 0.5% of Prize_Pool

So I was doing this;

Total_Entrants = 100

Entry_Fee = 5.50

Discount = 10;

Total_Entrants * Entry_Fee = Total_Price

100 * 5.50 = 550

Total_Price - (Total_Price * (Discount/100)) = Prize_Pool

550 - (550 * (10/100)) = 500

Then I would split Prize_Pool

500/2 = 250

Calculate Groups

Total_Entrants/10 = Group_Number

100/10 = 10 (groups of 10)

Allocate bottom half of Prize_Pool to lower brackets as per above percentages, which works out perfectly.

11-20 = 2% x (100/Total_Entrants) x Prize_Pool = Prize_Group2

2% x 1 x 500 = 10

21-30 = 1.5% x (100/Total_Entrants) x Prize_Pool = Prize_Group3

1.5% x 1 x 500 = 7.5

31-40 = 1%% x (100/Total_Entrants) x Prize_Pool = Prize_Group4

1% x 1 x 500 = 5

41-50 = 0.5% x (100/Total_Entrants) x Prize_Pool = Prize_Group5

0.5% x 1 x 500 = 2.5

This all adds up to 50%

Then for the Top 10%, I calculated a value for N. Calculating the value 30 I had a little help so can't expand on that.

N = 30/(SUM of player index count)% of Prize_Pool

N = 30/(1+2+3+4+5+6+7+8+9+10)% of 500

N = 30/55% of 500

N = 0.5454545% of 500 = 2.7272725

Rounded this value up to 3 therefore N = 3

Then I calculated top 10 like so...

1 = 2% + 10N = 40

2 = 2% + 9N = 37

3 = 2% + 8N = 34

4 = 2% + 7N = 31

5 = 2% + 6N = 28

6 = 2% + 5N = 25

7 = 2% + 4N = 22

8 = 2% + 3N = 19

9 = 2% + 2N = 16

10 = 2% + N = 13

This all added up exactly the problem was the scaling due to rounding the groups and the value of N.

It worked sweet for 100, 90, 80, 70, 60, 50 but started finding issues due to rounding.

I actually had it rounding perfectly however values from 91-99, 81-89 etc. ended up with a remainder which stopped me in my tracks.

I couldn't find a solution so thought why not start from scratch without the percentages and group classification being so strict.

I have a lot more workings etc. but thought someone here had an idea on where to start.

Thanks in advance.