skillratings

Calculate a player's skill level using Elo and Glicko-2 algorithms known from their usage in chess and other games.

Installation

Add the following to your Cargo.toml file:

toml [dependencies] skillratings = "0.1.0"

Usage

For a detailed guide on how to use this crate, head over to the documentation.

Elo rating system

```rust extern crate skillratings;

use skillratings;

let playerone = skillratings::rating::EloRating { rating: 1000.0 }; let playertwo = skillratings::rating::EloRating { rating: 1000.0 };

// The outcome is from the perspective of player one. let outcome = skillratings::outcomes::Outcomes::WIN;

let (playeronenew, playertwonew) = skillratings::elo::elo(playerone, playertwo, outcome, 32.0); asserteq!(playeronenew.rating, 1016.0); asserteq!(playertwonew.rating, 984.0); ```

Glicko-2 rating system

Instead of the traditional way of calculating the Glicko-2 for only one player only using a list of results, we are calculating the Glicko-2 rating for two players at once, like in the Elo calculation, to make it easier to see instant results.

```rust extern crate skillratings;

use skillratings;

let playerone = skillratings::rating::GlickoRating { rating: 1500.0, deviation: 350.0, volatility: 0.06 }; let playertwo = skillratings::rating::GlickoRating { rating: 1500.0, deviation: 350.0, volatility: 0.06 };

let outcome = skillratings::outcomes::Outcomes::WIN;

let (playeronenew, playertwonew) = skillratings::glicko2::glicko2(playerone, playertwo, outcome, 0.5);

asserteq!(playeronenew.rating.round(), 1662.0); asserteq!(playeronenew.deviation.round(), 290.0);

asserteq!(playertwonew.rating.round(), 1338.0); asserteq!(playertwonew.deviation.round(), 290.0); ```

License

This project is licensed under the MIT License.