glicko v0.2.0 Glicko

Provides the implementation of the Glicko rating system.

See the specification for implementation details.

Usage

Players can be represented by either the convenience Glicko.Player module or a tuple (see player_t). Results can be represented by either the convenience Glicko.Result module or a tuple (see result_t).

Get a player’s new rating after a series of matches in a rating period.

iex> results = [Result.new(Player.new_v1([rating: 1400, rating_deviation: 30]), :win),
...> Result.new(Player.new_v1([rating: 1550, rating_deviation: 100]), :loss),
...> Result.new(Player.new_v1([rating: 1700, rating_deviation: 300]), :loss)]
iex> player = Player.new_v1([rating: 1500, rating_deviation: 200])
iex> Glicko.new_rating(player, results, [system_constant: 0.5])
%Glicko.Player{version: :v1, rating: 1464.0506705393013, rating_deviation: 151.51652412385727, volatility: nil}

Get a player’s new rating when they haven’t played within a rating period.

iex> player = Player.new_v1([rating: 1500, rating_deviation: 200])
iex> Glicko.new_rating(player, [], [system_constant: 0.5])
%Glicko.Player{version: :v1, rating: 1.5e3, rating_deviation: 200.27141669877065, volatility: nil}

Link to this section Summary

Functions

Generate a new rating from an existing rating and a series (or lack) of results

Link to this section Types

Link to this type new_rating_opts_t()
new_rating_opts_t() :: [system_constant: float(), convergence_tolerance: float()]
Link to this type player_t()
player_t() :: player_v1_t() | player_v2_t()
Link to this type player_v1_t()
player_v1_t() :: {rating :: rating_t(), rating_deviation :: rating_deviation_t()}
Link to this type player_v2_t()
player_v2_t() :: {rating :: rating_t(), rating_deviation :: rating_deviation_t(), volatility :: volatility_t()}
Link to this type rating_deviation_t()
rating_deviation_t() :: float()
Link to this type rating_t()
rating_t() :: float()
Link to this type result_t()
result_t() :: {opponent :: player_t(), score :: score_t()}
Link to this type score_t()
score_t() :: float()
Link to this type version_t()
version_t() :: :v1 | :v2
Link to this type volatility_t()
volatility_t() :: float()

Link to this section Functions

Link to this function new_rating(player, results, opts \\ [])
new_rating(player :: player_t() | Glicko.Player.t(), results :: [result_t() | Glicko.Result.t()], opts :: new_rating_opts_t()) ::
  player_t() |
  Glicko.Player.t()

Generate a new rating from an existing rating and a series (or lack) of results.

Returns the updated player with the same version given to the function.