问题:
如果您访问底部的http://www.newedenfaces.com/ ,您可以看到玩家排行榜。每个人都以1400的基础分数开始。数据库中目前有超过 1100 名玩家,每次投票时都会随机挑选其中两名。截至目前,最高评分为1572。此外排行榜非常不稳定。刚刚进入前 10 名的人现在在 70+ 范围内。
我希望分数更重要。排行榜中的大多数人仅相差几个评分,有些人甚至评分。
对不起丑陋和冗长的代码。稍后我需要对其进行重构。
eloRating: function(winnerIndex) {
var kFactor = 16;
if (winnerIndex == 0) {
// A won
var ratingA = this.collection.at(0).get('rating');
var ratingB = this.collection.at(1).get('rating');
var scoreA = this.collection.at(0).get('wins');
var scoreB = this.collection.at(1).get('wins');
var expectedA = 1.0 / (1.0 + Math.pow(10, ((ratingA - ratingB) / 400)));
var expectedB = 1.0 / (1.0 + Math.pow(10, ((ratingA - ratingB) / 400)));
var newRatingA = ratingA + (kFactor * expectedA);
var newRatingB = ratingB - (kFactor * expectedA);
this.collection.at(0).set('rating', Math.round(newRatingA));
this.collection.at(1).set('rating', Math.round(newRatingB));
} else {
// B won
var ratingA = this.collection.at(0).get('rating');
var ratingB = this.collection.at(1).get('rating');
var scoreA = this.collection.at(0).get('wins');
var scoreB = this.collection.at(1).get('wins');
var expectedA = 1.0 / (1.0 + Math.pow(10, ((ratingB - ratingA) / 400)));
var expectedB = 1.0 / (1.0 + Math.pow(10, ((ratingB - ratingA) / 400)));
var newRatingA = ratingA - (kFactor * expectedA);
var newRatingB = ratingB + (kFactor * expectedA);
this.collection.at(0).set('rating', Math.round(newRatingA));
this.collection.at(1).set('rating', Math.round(newRatingB));
}