Jedaii_Competitive_Script/elo.js

11 lines
326 B
JavaScript
Raw Normal View History

2024-08-16 22:46:46 +00:00
// elo.js
function calculateElo(currentRating, opponentRating, actualScore, kFactor = 32) {
const expectedScore = 1 / (1 + Math.pow(10, (opponentRating - currentRating) / 400));
const newRating = currentRating + kFactor * (actualScore - expectedScore);
return newRating;
}
module.exports = {
calculateElo,
};