Reputation: 23
This is a math question really, I'm trying to give a rank to users based on two things: the time it takes them to do something and a percentage.
Basically, the shortest time + the highest percentage gives the best rank. On the opposite, the longest time + the lowest percentage will give the worst rank.
I'm trying to find out a formula for this. Ideally it would return x points and then I'll sort the users based on the points they each have.
Example (totally random):
- user has 94% and 2.3 seconds: he will get a ranking point of 123
- user has 56% and 2.3 seconds: he will get a ranking point of 87
- user has 56% and 5.1 seconds: he will get a ranking point of 73
OPTION: the percentage should weight more than the time in the final result
What a good formula would be ?
Upvotes: 1
Views: 1751
Reputation: 2576
There are two things to consider:
Impact
This basically scores each of the two factors separately but normalises them and weighs them.
score = (factor_A_impact * player_score_of_factor_A / maximum_score_of_factor_A) + (factor_B_impact * player_score_of_factor_B / maximum_score_of_factor_B);
Cross-over
This adds a crossover effect. In effect making score A more important then B because it affects the end value of B. The crossover factor is ranging from 1 to 0. 0 is no modulation what so ever of the b impact and 1 is complete modulation of the B factor by the A Factor. You can add as many factors as you want to this and chain them up in various complicated ways.
crossOverFactor = 0.2
score_factor_A_normalised = (player_score_of_factor_A / maximum_score_of_factor_A);
score_factor_B_normalised = (player_score_of_factor_B / maximum_score_of_factor_B);
score_B_crossOveredByA = score_factor_B_normalised*(1-crossOverFactor) + (score_factor_A_normalised*crossOverFactor*score_factor_B_normalised);
score = (score_factor_A_normalised*factor_A_impact) + (score_B_crossOveredByA * factor_B_impact);
Upvotes: 5
Reputation: 2055
Please clarify what the end-goal is. It can depend on what, according to you is more important- percentage or time. Then, you can assign points, e.g if there are 25 data points,
stepValue = 100/25 # = 4
percentagePoints = ((25+1) - percentageRank)*stepValue
This will score the highest % 100, the next 96, then 92 etc. Do the same for time.
Take a simple average/sum of the two scores, or a weighted average if you decide one is more important than the other (and manage to decide which one is how much more important than the other).
Upvotes: 0