I hope this is the right forum for this question.
Although I'm working in PHP, I really just need the algorithm (in pseudocode preferably) for a complex (at least seems to me) scoring system. The algorithm should always place the highest number of correct answers at the top of the list and use remaining clock time as bonus (mainly used as a tie breaker). Essentially, I want to rank users based on accuracy (correct or incorrect) with a speed bonus (remaining clock time)
Essentially we collect points per question, clock time left per question (higher amount = faster answer) and number of correct answers.
The problem I'm having is figuring out how to implement the time left as a bonus. What I've run across is that the time bonus ends up making up for missed questions. Also, different questions may have different weights (ie Q1 is worth 50 points, Q2 is worth 20 points, etc...) which then adds a complexity to the algorithm. Also, clock time per question may also vary. Here's an example:
userid num_correct total_points total_clock
1 7 315 625
2 4 423 742
3 9 647 716
4 2 186 573
5 4 423 218
6 4 515 185
With this list, id number 3 should be first since they got 9 correct, followed by id 1.
Third place should be id 6 since they had the third highest correct, but also had a higher point score. then fourth place should be id 2 since they had a higher clock.
Obviously my issue isn't sorting, that's the easy part. What I need to figure out is how to calculate a total score that would correlate with the order. Essentially, num_correct has a higher weight than total points than total clock.
Here's what I have with the help of MS Excel
-min(total_points) * .75 ==> [max_allowed], max amount of bonus points (clock points). The .75 was an arbitrary number in order for max_allowed to be less than the least amount of points recorded so that the clock points can't make up for a missed question
-max(total_clock) ==> [max_clock], time leader of which we'll use to rate clocks as a percentage
-if(id.total_clock > max_allowed, max_allowed, id.total_clock) ==> [clock_points]
-clock_points + (num_correct * (total_clock / max_clock)) ==> [weighted_clock]
-total_points + (num_correct * (average_points / 2)) ==> [weighted_points]
-weighted_clock + weighted_points ==> [total_score]
The issues with this "algorithm" is that average_points is an arbitrary preset number. I won't always know what that number is going to be therefore if each question has a different point scheme, this "algorithm" will fail.
Any one have any ideas? I'm not stuck to this algorithm and I'm looking for some suggestions that would give me a total_score that would match with the sorting described above.
Thanks in advance!