sglicko2


License

License

ISC
GroupId

GroupId

eu.flierl
ArtifactId

ArtifactId

sglicko2_2.13
Last Version

Last Version

1.7.1
Release Date

Release Date

Type

Type

jar
Description

Description

sglicko2
sglicko2
Project URL

Project URL

https://github.com/asflierl/sglicko2
Project Organization

Project Organization

eu.flierl
Source Code Management

Source Code Management

https://github.com/asflierl/sglicko2

Download sglicko2_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/eu.flierl/sglicko2_2.13/ -->
<dependency>
    <groupId>eu.flierl</groupId>
    <artifactId>sglicko2_2.13</artifactId>
    <version>1.7.1</version>
</dependency>
// https://jarcasting.com/artifacts/eu.flierl/sglicko2_2.13/
implementation 'eu.flierl:sglicko2_2.13:1.7.1'
// https://jarcasting.com/artifacts/eu.flierl/sglicko2_2.13/
implementation ("eu.flierl:sglicko2_2.13:1.7.1")
'eu.flierl:sglicko2_2.13:jar:1.7.1'
<dependency org="eu.flierl" name="sglicko2_2.13" rev="1.7.1">
  <artifact name="sglicko2_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='eu.flierl', module='sglicko2_2.13', version='1.7.1')
)
libraryDependencies += "eu.flierl" % "sglicko2_2.13" % "1.7.1"
[eu.flierl/sglicko2_2.13 "1.7.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.5

test (6)

Group / Artifact Type Version
org.specs2 : specs2-core_2.13 jar 4.10.6
org.specs2 : specs2-matcher_2.13 jar 4.10.6
org.specs2 : specs2-matcher-extra_2.13 jar 4.10.6
org.specs2 : specs2-scalacheck_2.13 jar 4.10.6
org.specs2 : specs2-html_2.13 jar 4.10.6
org.scalacheck : scalacheck_2.13 jar 1.15.3

Project Modules

There are no modules declared in this project.

sglicko2 Build Status Maven Central Join the chat at https://gitter.im/asflierl/sglicko2

A small, simple & self-contained implementation of the Glicko-2 rating algorithm in Scala that also helps the user with maintaining a leaderboard and allows for custom scoring rules.

Setup

Version 1.7.1 is currently available for Scala 3 and 2.13, targetting Java 8.

To use this library in your SBT project, add the following to your build definition:

libraryDependencies += "eu.flierl" %% "sglicko2" % "1.7.1"

Usage

Here's a simple, runnable example on how the library can be used. You can experiment with it right in your browser (using Scastie).

import sglicko2._, EitherOnePlayerWinsOrItsADraw._

object Example extends App {
  val glicko2 = new Glicko2[String, EitherOnePlayerWinsOrItsADraw]

  val ratingPeriod = glicko2.newRatingPeriod.withGames(
    ("Abby", "Becky", Player1Wins),
    ("Abby", "Chas", Player1Wins),
    ("Abby", "Dave", Player1Wins),
    ("Becky", "Chas", Player2Wins),
    ("Becky", "Dave", Draw),
    ("Chas", "Dave", Player2Wins))

  val leaderboard = glicko2.updatedLeaderboard(glicko2.newLeaderboard, ratingPeriod)

  def pretty(r: RankedPlayer[String]) = 
    f"${r.rank}%2d ${r.player.id}%5s ${r.player.rating}%4.0f " +
    f"${r.player.deviation * 2d}%4.0f)"

  leaderboard.rankedPlayers map pretty foreach println
}

Output:

 1  Abby 1800 (± 455)
 2  Dave 1500 (± 455)
 3  Chas 1400 (± 455)
 4 Becky 1300 (± 455)

You can find more example code in the test sources. The main sources should be very easy to understand, too, so don't hesitate to look at those if you have questions.

Also, if you use this library, I'd love to hear from you. Thanks <3

Note on earlier versions

Earlier versions of this library are hosted on Bintray and will be available until February 1st 2022 after which Bintray/JCenter will be retired by JFrog and completely go out of service.

If you are still depending on these versions consider migrating as soon as possible before your build breaks in 2022.

Versions 1.6 and 1.7 are available for Scala 2.13.

The last version to support Scala 2.11 and 2.12 was 1.5. The last version to support Scala 2.10 was 1.3.

Access them by adding the JCenter repo to your build along with the actual dependency:

resolvers += Resolver.jcenterRepo
libraryDependencies += "sglicko2" %% "sglicko2" % "1.7"

Versions

Version
1.7.1
1.7.0