mirror of
				https://github.com/avitex/elixir-glicko
				synced 2025-11-04 07:33:27 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			93c09273d2
			...
			55a08effbc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					55a08effbc | ||
| 
						 | 
					28cea24d66 | 
@ -14,6 +14,6 @@ Add `glicko` to your list of dependencies in `mix.exs`:
 | 
			
		||||
 | 
			
		||||
```elixir
 | 
			
		||||
def deps do
 | 
			
		||||
  [{:glicko, "~> 0.6.0"}]
 | 
			
		||||
  [{:glicko, "~> 0.7.0"}]
 | 
			
		||||
end
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -143,7 +143,7 @@ defmodule Glicko.Player do
 | 
			
		||||
  @doc """
 | 
			
		||||
  A version agnostic method for getting a player's rating.
 | 
			
		||||
  """
 | 
			
		||||
  @spec rating(player :: t, as_version :: version) :: rating
 | 
			
		||||
  @spec rating(player :: t, as_version :: version | nil) :: rating
 | 
			
		||||
  def rating(player, as_version \\ nil)
 | 
			
		||||
  def rating({rating, _}, nil), do: rating
 | 
			
		||||
  def rating({rating, _, _}, nil), do: rating
 | 
			
		||||
@ -155,7 +155,7 @@ defmodule Glicko.Player do
 | 
			
		||||
  @doc """
 | 
			
		||||
  A version agnostic method for getting a player's rating deviation.
 | 
			
		||||
  """
 | 
			
		||||
  @spec rating_deviation(player :: t, as_version :: version) :: rating_deviation
 | 
			
		||||
  @spec rating_deviation(player :: t, as_version :: version | nil) :: rating_deviation
 | 
			
		||||
  def rating_deviation(player, as_version \\ nil)
 | 
			
		||||
  def rating_deviation({_, rating_deviation}, nil), do: rating_deviation
 | 
			
		||||
  def rating_deviation({_, rating_deviation, _}, nil), do: rating_deviation
 | 
			
		||||
@ -192,7 +192,7 @@ defmodule Glicko.Player do
 | 
			
		||||
  When a player has a low RD, the interval would be narrow, so that we would
 | 
			
		||||
  be 95% confident about a player’s strength being in a small interval of values.
 | 
			
		||||
  """
 | 
			
		||||
  @spec rating_interval(player :: t) :: {rating_low :: float, rating_high :: float}
 | 
			
		||||
  @spec rating_interval(player :: t, as_version :: version | nil) :: {rating_low :: float, rating_high :: float}
 | 
			
		||||
  def rating_interval(player, as_version \\ nil) do
 | 
			
		||||
    {
 | 
			
		||||
      rating(player, as_version) - rating_deviation(player, as_version) * 2,
 | 
			
		||||
 | 
			
		||||
@ -52,18 +52,18 @@ defmodule Glicko.Result do
 | 
			
		||||
  @doc """
 | 
			
		||||
  Convenience function for accessing an opponent's rating.
 | 
			
		||||
  """
 | 
			
		||||
  @spec opponent_rating(result :: Result.t()) :: Player.rating()
 | 
			
		||||
  @spec opponent_rating(result :: t()) :: Player.rating()
 | 
			
		||||
  def opponent_rating(_result = {rating, _, _}), do: rating
 | 
			
		||||
 | 
			
		||||
  @doc """
 | 
			
		||||
  Convenience function for accessing an opponent's rating deviation.
 | 
			
		||||
  """
 | 
			
		||||
  @spec opponent_rating_deviation(result :: Result.t()) :: Player.rating_deviation()
 | 
			
		||||
  @spec opponent_rating_deviation(result :: t()) :: Player.rating_deviation()
 | 
			
		||||
  def opponent_rating_deviation(_result = {_, rating_deviation, _}), do: rating_deviation
 | 
			
		||||
 | 
			
		||||
  @doc """
 | 
			
		||||
  Convenience function for accessing the score.
 | 
			
		||||
  """
 | 
			
		||||
  @spec score(result :: Result.t()) :: score
 | 
			
		||||
  @spec score(result :: t()) :: score
 | 
			
		||||
  def score(_result = {_, _, score}), do: score
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user