1
0
mirror of https://github.com/avitex/elixir-glicko synced 2024-11-22 03:09:57 +00:00

More documentation, final preparation

This commit is contained in:
avitex 2017-11-16 15:18:57 +11:00
parent 48645e1298
commit 168ec234dc
3 changed files with 30 additions and 4 deletions

View File

@ -1,8 +1,9 @@
[![Build Status](https://travis-ci.org/avitex/elixir-glicko.svg)](https://travis-ci.org/avitex/elixir-glicko)
[![Hex.pm](https://img.shields.io/hexpm/v/glicko.svg)](https://hex.pm/packages/glicko)
[![Hex Docs](https://img.shields.io/badge/hex-docs-blue.svg)](https://hexdocs.pm/glicko)
[![Inline docs](http://inch-ci.org/github/avitex/elixir-glicko.svg)](http://inch-ci.org/github/avitex/elixir-glicko)
# Glicko (IN-PROGRESS)
# Glicko
**Implementation of the [Glicko rating system](http://www.glicko.net/glicko.html).**
Documentation hosted on [hexdocs](https://hexdocs.pm/glicko).

View File

@ -1,4 +1,27 @@
defmodule Glicko do
@moduledoc """
Provides the implementation of the Glicko rating system.
See the [specification](http://www.glicko.net/glicko/glicko2.pdf) for implementation details.
## Usage
Get a players new rating after a series of matches in a rating period.
iex> results = [GameResult.new(Player.new_v1([rating: 1400, rating_deviation: 30]), :win),
...> GameResult.new(Player.new_v1([rating: 1550, rating_deviation: 100]), :loss),
...> GameResult.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 players 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}
"""
alias __MODULE__.{
Player,
@ -11,7 +34,9 @@ defmodule Glicko do
@type new_rating_opts_t :: [system_constant: float, convergence_tolerance: float]
@doc """
Generate a new Rating from an existing rating and a series of results.
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.
"""
@spec new_rating(player :: Player.t, results :: list(GameResult.t), opts :: new_rating_opts_t) :: Player.t
def new_rating(player, results, opts \\ [])

View File

@ -1,6 +1,6 @@
defmodule Glicko.GameResult do
@moduledoc """
This module provides a representation of a game result against an opponent.
Provides a representation of a game result against an opponent.
## Usage