glicko v0.1.0 Glicko.GameResult

Provides a representation of a game result against an opponent.

Usage

iex> opponent = Player.new_v2
iex> GameResult.new(opponent, 0.0)
%GameResult{score: 0.0, opponent: %Player{version: :v2, rating: 0.0, rating_deviation: 2.014761872416068, volatility: 0.06}}
iex> GameResult.new(opponent, :win) # With shortcut
%GameResult{score: 1.0, opponent: %Player{version: :v2, rating: 0.0, rating_deviation: 2.014761872416068, volatility: 0.06}}

Link to this section Summary

Functions

Creates a new GameResult against an opponent

Link to this section Types

Link to this type result_type_t()
result_type_t() :: :loss | :draw | :win
Link to this type t()
t() :: %Glicko.GameResult{opponent: Glicko.Player.t(), score: float()}

Link to this section Functions

Link to this function new(opponent, result_type)
new(opponent :: Glicko.Player.t(), result_type_t() | float()) :: t()

Creates a new GameResult against an opponent.

Supports passing either :loss, :draw, or :win as shortcuts.