mirror of
https://github.com/avitex/elixir-glicko
synced 2024-11-22 03:09:57 +00:00
Prepare for publish
This commit is contained in:
parent
b6dd4c2dee
commit
61175818ad
@ -9,7 +9,7 @@ defmodule Glicko do
|
|||||||
Players can be represented by either the convenience `Glicko.Player` module or a tuple (see `player_t`).
|
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`).
|
Results can be represented by either the convenience `Glicko.Result` module or a tuple (see `result_t`).
|
||||||
|
|
||||||
Get a players new rating after a series of matches in a rating period.
|
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),
|
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: 1550, rating_deviation: 100]), :loss),
|
||||||
@ -18,7 +18,7 @@ defmodule Glicko do
|
|||||||
iex> Glicko.new_rating(player, results, [system_constant: 0.5])
|
iex> Glicko.new_rating(player, results, [system_constant: 0.5])
|
||||||
%Glicko.Player{version: :v1, rating: 1464.0506705393013, rating_deviation: 151.51652412385727, volatility: nil}
|
%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.
|
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> player = Player.new_v1([rating: 1500, rating_deviation: 200])
|
||||||
iex> Glicko.new_rating(player, [], [system_constant: 0.5])
|
iex> Glicko.new_rating(player, [], [system_constant: 0.5])
|
||||||
|
@ -172,14 +172,14 @@ defmodule Glicko.Player do
|
|||||||
}
|
}
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Scales a players rating.
|
Scales a player's rating.
|
||||||
"""
|
"""
|
||||||
@spec scale_rating_to(rating :: Glicko.rating_t, to_version :: Glicko.version_t) :: Glicko.rating_t
|
@spec scale_rating_to(rating :: Glicko.rating_t, to_version :: Glicko.version_t) :: Glicko.rating_t
|
||||||
def scale_rating_to(rating, :v1), do: (rating * @magic_version_scale) + @magic_version_scale_rating
|
def scale_rating_to(rating, :v1), do: (rating * @magic_version_scale) + @magic_version_scale_rating
|
||||||
def scale_rating_to(rating, :v2), do: (rating - @magic_version_scale_rating) / @magic_version_scale
|
def scale_rating_to(rating, :v2), do: (rating - @magic_version_scale_rating) / @magic_version_scale
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Scales a players rating deviation.
|
Scales a player's rating deviation.
|
||||||
"""
|
"""
|
||||||
@spec scale_rating_deviation_to(rating_deviation :: Glicko.rating_deviation_t, to_version :: Glicko.version_t) :: Glicko.rating_deviation_t
|
@spec scale_rating_deviation_to(rating_deviation :: Glicko.rating_deviation_t, to_version :: Glicko.version_t) :: Glicko.rating_deviation_t
|
||||||
def scale_rating_deviation_to(rating_deviation, :v1), do: rating_deviation * @magic_version_scale
|
def scale_rating_deviation_to(rating_deviation, :v1), do: rating_deviation * @magic_version_scale
|
||||||
|
Loading…
Reference in New Issue
Block a user