Class: ICU::RatedPlayer::ProvRating
- Inherits:
-
ICU::RatedPlayer
- Object
- ICU::RatedPlayer
- ICU::RatedPlayer::ProvRating
- Defined in:
- lib/icu_ratings/player.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#games ⇒ Object
readonly
Returns the value of attribute games.
-
#rating ⇒ Object
readonly
Returns the value of attribute rating.
Attributes inherited from ICU::RatedPlayer
#desc, #num, #performance, #results, #type
Instance Method Summary collapse
- #average_performance(new_performance, new_games) ⇒ Object
-
#initialize(num, desc, rating, games) ⇒ ProvRating
constructor
A new instance of ProvRating.
- #new_rating(type = nil) ⇒ Object
Methods inherited from ICU::RatedPlayer
#==, #add_result, check_games, check_kfactor, check_num, check_rating, #estimate_performance, #expected_score, factory, kfactor, #rate!, #reset, #score, #update_performance
Constructor Details
#initialize(num, desc, rating, games) ⇒ ProvRating
Returns a new instance of ProvRating.
290 291 292 293 294 295 |
# File 'lib/icu_ratings/player.rb', line 290 def initialize(num, desc, , games) @type = :provisional @rating = @games = games super(num, desc) end |
Instance Attribute Details
#games ⇒ Object (readonly)
Returns the value of attribute games.
288 289 290 |
# File 'lib/icu_ratings/player.rb', line 288 def games @games end |
#rating ⇒ Object (readonly)
Returns the value of attribute rating.
288 289 290 |
# File 'lib/icu_ratings/player.rb', line 288 def @rating end |
Instance Method Details
#average_performance(new_performance, new_games) ⇒ Object
301 302 303 304 305 |
# File 'lib/icu_ratings/player.rb', line 301 def average_performance(new_performance, new_games) old_performance = games * old_games = games (new_performance + old_performance) / (new_games + old_games) end |
#new_rating(type = nil) ⇒ Object
297 298 299 |
# File 'lib/icu_ratings/player.rb', line 297 def (type=nil) performance end |