The leaderboard on the Teknojelly home page shows individual and country ratings, which country a player plays for is set on their Profile page. The leaderboard uses the Elo rating system where the player and country ratings are represented by a number which may change depending on quiz results.
If a player beats gniruT at a quiz the win counts towards the individual and country ratings, if a player does not beat gniruT the attempt is also counted. gniruT@alpha is the ai that players play against in the quizzes and gniruT@Team is the ai that countries are rated against.
Each player is assigned a rating of 1200 when they sign up and both gniruT@alpha and gniruT@Team were assigned 2400 points in the beginning.
The difference in the ratings between the players or countries and gniruT serves as a predictor of the outcome of a quiz. With equal ratings they are expected to score an equal number of wins but the player or ai with the higher rating is expected to win more often than not.
After every quiz, the winning player or ai takes points from the losing one. The difference between the ratings of the winner and loser determines the total number of points gained or lost after a quiz. If the higher rating wins, then only a few rating points will be taken from the lower rating. However, if the lower rating scores an upset win, many rating points will be transferred.
To win a quiz the player has to get a certain percentage of questions correct. For example to win at a Practice quiz the player has to get more than 95% correct and to win at a Brain Buster quiz the player has to get more than 89% correct.
This is how the algorithm works-
p = Probability of Player winning with Player Rating
g = Probability of gniruT winning with gniruT Rating
which is given by
p = 1.0 / (1 + math.pow(10, 1.0 * (gniruT Rating - Player Rating) / 400))
g = 1.0 / (1 + math.pow(10, 1.0 * (Player Rating - gniruT Rating) / 400))
The new player rating is given by
New Player Rating = Player Rating + K*(Actual Result - Expected Result)
- K is a constant that affects the magnitude of the change
- Actual Result is a 1 for a win or a 0 for a loss
- Expected Result is the probability of a win
So for example if a player with Player Rating = 1400 beats gniruT with gniruT Rating = 1800
p = 1.0 / (1 + math.pow(10, 1.0 * (1800 - 1400) / 400))
g = 1.0 / (1 + math.pow(10, 1.0 * (1400 - 1800) / 400))
p = 0.09
g = 0.91
If the player wins
New Player Rating = 1400 + 20(1 - 0.09) = 1418.2
New gniruT Rating = 1800 + 20(0 - 0.91) = 1781.8
If gniruT wins
New Player Rating = 1400 + 20(0 - 0.09) = 1398.2
New gniruT Rating = 1800 + 20(1 - 0.91) = 1801.8
This core logic is extended across all players and countries.