Class: ICU::RatedPlayer::ProvRating

Inherits:
ICU::RatedPlayer show all
Defined in:
lib/icu_ratings/player.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from ICU::RatedPlayer

#desc, #num, #performance, #results, #type

Instance Method Summary collapse

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, rating, games)
  @type = :provisional
  @rating = rating
  @games = games
  super(num, desc)
end

Instance Attribute Details

#gamesObject (readonly)

Returns the value of attribute games.



288
289
290
# File 'lib/icu_ratings/player.rb', line 288

def games
  @games
end

#ratingObject (readonly)

Returns the value of attribute rating.



288
289
290
# File 'lib/icu_ratings/player.rb', line 288

def rating
  @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 * rating
  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 new_rating(type=nil)
  performance
end