Glicko.Result (glicko v0.8.0)
Provides convenience functions for handling a result against an opponent.
Usage
iex> opponent = Player.new_v2
iex> Result.new(opponent, 1.0)
%Result{opponent_rating: 0.0, opponent_rating_deviation: 2.014761872416068, score: 1.0}
iex> Result.new(opponent, :draw) # With shortcut
%Result{opponent_rating: 0.0, opponent_rating_deviation: 2.014761872416068, score: 0.5}
Link to this section Summary
Functions
Creates a new result from an opponent and score.
Creates a new result from an opponent rating, opponent rating deviation and score.
Convenience function for accessing an opponent's rating.
Convenience function for accessing an opponent's rating deviation.
Convenience function for accessing the score.
Link to this section Types
score()
Specs
score() :: float()
score_shortcut()
Specs
score_shortcut() :: :loss | :draw | :win
Specs
t() :: %Glicko.Result{ opponent_rating: Glicko.Player.rating(), opponent_rating_deviation: Glicko.Player.rating_deviation(), score: score() }
Link to this section Functions
new(opponent, score)
Specs
new(opponent :: Glicko.Player.t(), score :: score() | score_shortcut()) :: t()
Creates a new result from an opponent and score.
Supports passing either :loss
, :draw
, or :win
as shortcuts.
new(opponent_rating, opponent_rating_deviation, score)
Specs
new( Glicko.Player.rating(), Glicko.Player.rating_deviation(), score() | score_shortcut() ) :: t()
Creates a new result from an opponent rating, opponent rating deviation and score.
Values provided for the opponent rating and opponent rating deviation must be v2 based.
Supports passing either :loss
, :draw
, or :win
as shortcuts.
opponent_rating(result)
Specs
opponent_rating(result :: t()) :: Glicko.Player.rating()
Convenience function for accessing an opponent's rating.
opponent_rating_deviation(result)
Specs
opponent_rating_deviation(result :: t()) :: Glicko.Player.rating_deviation()
Convenience function for accessing an opponent's rating deviation.
score(result)
Specs
Convenience function for accessing the score.