I think I've got this. For argument's sake lets say player Dave has the following scores:
18,33,14,27,21,24
and lets say the query checks those rows as X.score in the order they appear here. I know it could be random which row is checked, but hey, it's my scenario.
so X.score=18 is checked and there are four rows with scores greater than it, so it gets discarded.
it would then move on to X.score=33 and find out there are no scores above that so that would be one of the rows that we would use.
It would then step through X.score=14 and discard it for the same reason as X.score=18.
It then steps through to X.score=27 and finds there is only one score greater than it so it must be the second highest score.
So then the scores are 33 and 27 and we now take the average of those two scores to find that Dave has an average score of 30 correct?
So if we wanted the top 3 scores averaged we merely change the 2 > to 3 > in the code above?
That sounds good to me.