forwardloop / glicko2s   0.9.4

MIT License GitHub

Glicko2 (improved ELO) sports players rating system for the JVM

Scala versions: 2.12 2.11

License: MIT Maven Central Build Status Coverage Status


Glicko2 sport players' rating algorithm for the JVM. Details on ELO and Glicko systems can be found at ELO Wikipedia, Glicko Wikipedia, or Glicko-2 Example. This project is used for computing ELO ratings in the squash players ranking system, for example in Waterfront and Fareham Leisure Centre leagues.





    compile 'com.github.forwardloop:glicko2s_2.12:0.9.4'


    libraryDependencies += "com.github.forwardloop" %% "glicko2s" % "0.9.4"


Compute new rating for a player based on a sequence of match results with other players:


     import static forwardloop.glicko2s.Glicko2J.newPlayerRating;
     import forwardloop.glicko2s.Glicko2;
     import scala.Tuple2;
     import java.util.Arrays;
     import java.util.List;
     Glicko2 player = newPlayerRating();
     Glicko2 opponent1 = newPlayerRating();
     Glicko2 opponent2 = newPlayerRating();
     Tuple2<Glicko2, Result> match1 = new Tuple2(opponent1, Glicko2J.Win);
     Tuple2<Glicko2, Result> match2 = new Tuple2(opponent2, Glicko2J.Loss);
     Tuple2<Glicko2, Result> match3 = new Tuple2(opponent1, Glicko2J.Win);
     List<Tuple2<Glicko2, Result>> results = Arrays.asList(match1, match2, match3);
     Glicko2 newRating = Glicko2J.calculateNewRating(player, results);


The project is cross-compiled for Scala 2.11 and 2.12.

    import forwardloop.glicko2s.{Loss, Win, Glicko2}
    val player, opponent1, opponent2 = new Glicko2
    val results = Seq(
         (opponent1, Win), 
         (opponent2, Loss), 
         (opponent1, Win))
    val newRating = player.calculateNewRating(results)

The rating, rating deviation and volatility parameters will change as follows:

    //player.toGlicko1:    rating: 1500, deviation: 350.00, volatility: 0.060000
    //newRating.toGlicko1: rating: 1600, deviation: 227.74, volatility: 0.059998


Weights of results

The simple implementation of the EloResult trait provided allows three outcomes: win, draw or loss with weights 1.0, 0.5, 0.0, respectively. This can be fine tuned to differentiate between outcomes like 3:0 and 3:2, to better reflect true players' level in ELO computations. An example implementation for racquet sports can be found here