Instant Glicko-2
This crate provides an implementation of the Glicko-2 rating system. Due to the concept of rating periods, Glicko-2 has the problem that rankings cannot easily be updated instantly after a match concludes.
This implementation aims to solve that problem by allowing fractional rating periods, so that ratings can be updated directly after every game, and not just once a rating period closes. This draws inspiration from the rating system implementation for open-source chess website Lichess, as well as two blogpost (1, 2) by Ryan Juckett on skill ratings for INVERSUS Deluxe.
Examples
Example calculation from Glickman's paper using algorithm
:
use ;
use ;
let parameters = default.with_volatility_change;
// Create our player's rating
let player = new;
// Create our opponents
// Their volatility is not specified in the paper and it doesn't matter in the calculation,
// so we're just using the default starting volatility.
let opponent_a = new;
let opponent_b = new;
let opponent_c = new;
// Create match results for our player
let results = ;
// Calculate new rating after 1.0 rating periods
let new_rating = rate_player;
// The results are close to the results from the paper.
assert!;
assert!;
assert!;
Different example using RatingEngine
:
use Duration;
use ;
use ;
let parameters = default;
// Create a RatingEngine with a one day rating period duration
// The first rating period starts instantly
let mut engine = start_new;
// Register two players
// The first player is relatively strong
let player_1_rating_old = new;
let player_1 = engine.register_player;
// The second player hasn't played any games
let player_2_rating_old = parameters.start_rating;
let player_2 = engine.register_player;
// They play and player_2 wins
engine.register_result;
// Print the new ratings
// Type signatures are needed because we could also work with the internal ScaledRating
// That skips one step of calculation,
// but the rating values are not as pretty and not comparable to the original Glicko ratings
let player_1_rating_new: Rating = engine.player_rating;
println!;
let player_2_rating_new: Rating = engine.player_rating;
println!;
// Loser's rating goes down, winner's rating goes up
assert!;
assert!;