Ranking methods: Difference between revisions

Line 791:
 
===Functional ES5===
 
The task formulation doesn't seem to directly explain or determine the order of listing for players whose score is the same.
 
( This version chooses to use a secondary (alphabetic sort) after the numeric sort by score. This does, of course, affect the ordinal placements for some players)
 
<lang JavaScript>(function () {
Line 799 ⟶ 803:
sorted = xs.map(function (x, i) {
return { name: x, score: ns[i] };
}).sort(function (a, b) { return b.score - a.score; }),
var d = b.score - a.score;
return d ? d : (
a.name < b.name ? -1 : (
a.name > b.name ? 1 : 0
)
)
}),
names = sorted.map(function (x) { return x.name; }),
Line 877 ⟶ 889:
| Solomon || 44 || 1 || 1 || 1 || 1 || 1
|-
| JasonErrol || 42 || 2 || 3 || 2 || 2 || 2.5
|-
| ErrolJason || 42 || 2 || 3 || 2 || 3 || 2.5
|-
| GarryBarry || 41 || 4 || 6 || 3 || 4 || 5
|-
| Bernard || 41 || 4 || 6 || 3 || 5 || 5
|-
| BarryGarry || 41 || 4 || 6 || 3 || 6 || 5
|-
| Stephen || 39 || 7 || 7 || 4 || 7 || 7
9,659

edits