CrazyDave1/Troll-Hunter — pull request #43 by scmx (2014-03-08 09:59:46+00:00)
Title: Refactor scores into score

#### Rename Scores into Score
Constructor names should always be in singular

#### Replace level.scores with level.player.score
Score belongs to players, not levels.
This change means that score can be persisted across levels

#### Refactor Highscore to fix sorting bug
Push score into highscore immediately when game begins
Also set htmlClass = 'current' to it
Undefine htmlClass on every other score in highscore

Add Highscore#sort() which sorts the highscore
Add Highscore#take(n) which returns the topmost n scores

Notera att jag har ändrat på sorteringen för att fixa en sorteringsbugg.
```javascript
// Före
list.sort(function(a, b) {
return a.total < b.total;
}
// Efter
list.sort(function(a, b) {
return b.total - a.total;
});
```
Numerisk sortering måste skrivas som `b - a`, det fungerar inte med `a < b`