Class: Elo::Rating
Overview
This class calculates the rating between two players, but only from one persons perspective. You need two Rating-instances to calculate ratings for both players. Luckily, Elo::Game handles this for you automatically.
Instance Attribute Summary collapse
-
#k_factor ⇒ Object
readonly
The k-factor you wish to use for this calculation.
-
#old_rating ⇒ Object
readonly
The rating of the player you wish to calculate.
-
#other_rating ⇒ Object
readonly
The rating of the player you DON“T wish to calculate.
Instance Method Summary collapse
-
#new_rating ⇒ Object
The new rating is…
Methods included from Helper
Instance Attribute Details
#k_factor ⇒ Object (readonly)
The k-factor you wish to use for this calculation.
18 19 20 |
# File 'lib/elo/rating.rb', line 18 def k_factor @k_factor end |
#old_rating ⇒ Object (readonly)
The rating of the player you wish to calculate.
15 16 17 |
# File 'lib/elo/rating.rb', line 15 def @old_rating end |
#other_rating ⇒ Object (readonly)
The rating of the player you DON“T wish to calculate.
12 13 14 |
# File 'lib/elo/rating.rb', line 12 def @other_rating end |
Instance Method Details
#new_rating ⇒ Object
The new rating is… wait for it… the new rating!
21 22 23 |
# File 'lib/elo/rating.rb', line 21 def + change.round end |