Created
November 23, 2020 02:21
-
-
Save mattmazzola/d1045006dcb7709fc863694299dff27a to your computer and use it in GitHub Desktop.
Create rating systems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const symmetricRatingSystem = createRatingSystem() | |
const playerKFactor = 32 | |
const questionKFactor = 4 | |
const asymmetricKFactorFn: KFactorFunctionWithPlayers = (rating, playerIndex) => { | |
let kFactor = playerIndex === 0 | |
? playerKFactor | |
: questionKFactor | |
if (rating > 6000) { | |
kFactor = Math.ceil(kFactor / 2) | |
} | |
else if (rating > 4000) { | |
kFactor = Math.ceil(kFactor / 1.5) | |
} | |
return kFactor | |
} | |
const asymmetricRatingSystem = createRatingSystem(asymmetricKFactorFn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment