Comparing version 0.1.0 to 0.1.2
14
index.js
@@ -19,5 +19,5 @@ 'use strict'; | ||
* | ||
* @param {Integer|Object} k_factor The maximum rating change, defaults to 32 | ||
* @param {Integer} min The minimum value a calculated rating can be | ||
* @param {Integer} max Integer The maximum value a calculated rating can be | ||
* @param {Number|Object} k_factor The maximum rating change, defaults to 32 | ||
* @param {Number} min The minimum value a calculated rating can be | ||
* @param {Number} max Integer The maximum value a calculated rating can be | ||
*/ | ||
@@ -76,3 +76,3 @@ var ELO = function(k_factor, min, max) { | ||
* | ||
* @return {Number} The minimum rating value, e.g. 2700 | ||
* @return {Number} The maximum rating value, e.g. 2700 | ||
*/ | ||
@@ -93,8 +93,6 @@ ELO.prototype.getMax = function() { | ||
ELO.prototype.setKFactor = function(k_factor) { | ||
this.k_factor = k_factor; | ||
if (!k_factor) { | ||
this.k_factor = 32; | ||
} else if (parseInt(k_factor, 10)) { | ||
this.k_factor = k_factor; | ||
} else if (typeof(k_factor) === 'object') { | ||
this.k_factor = k_factor; | ||
} | ||
@@ -101,0 +99,0 @@ |
{ | ||
"name": "arpad", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"description": "An implementation of the ELO Rating System", | ||
@@ -18,3 +18,3 @@ "main": "index.js", | ||
], | ||
"author": "Thomas Hunter II", | ||
"author": "Thomas Hunter II <me@thomashunter.name>", | ||
"license": "MIT", | ||
@@ -26,8 +26,8 @@ "directories": { | ||
"type": "git", | ||
"url": "https://github.com/tlhunter/node-arpad.git" | ||
"url": "https://github.com/PhobosRising/node-arpad.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/tlhunter/node-arpad/issues" | ||
"url": "https://github.com/PhobosRising/node-arpad/issues" | ||
}, | ||
"homepage": "https://github.com/tlhunter/node-arpad" | ||
"homepage": "https://github.com/PhobosRising/node-arpad" | ||
} |
@@ -150,2 +150,14 @@ 'use strict'; | ||
assert.equal(alice_new_rating, alice_new_rating_convenient); | ||
expected_alice_score = elo.expectedScore(alice_rating, bob_rating); | ||
alice_new_rating = elo.newRating(expected_alice_score, 0, alice_rating); | ||
alice_new_rating_convenient = elo.newRatingIfLost(alice_rating, bob_rating); | ||
assert.equal(alice_new_rating, alice_new_rating_convenient); | ||
expected_alice_score = elo.expectedScore(alice_rating, bob_rating); | ||
alice_new_rating = elo.newRating(expected_alice_score, 0.5, alice_rating); | ||
alice_new_rating_convenient = elo.newRatingIfTied(alice_rating, bob_rating); | ||
assert.equal(alice_new_rating, alice_new_rating_convenient); | ||
}); | ||
@@ -152,0 +164,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16881
391