class EasyElo::Rating

Public Class Methods

new(r1, r2, actual) click to toggle source
# File lib/easy_elo/rating.rb, line 5
def initialize(r1, r2, actual)
  @r1 = r1
  @r2 = r2
  @actual = actual
  @estimation = self.estimation
  @k_factor = EasyElo.config.k_factor
  @result = self.result
end

Public Instance Methods

estimation() click to toggle source
# File lib/easy_elo/rating.rb, line 14
def estimation
  sd = EasyElo.config.sd
  (1/2) + Math.erf((@r1.to_f - @r2.to_f)/(2*sd))/2
end
result() click to toggle source
# File lib/easy_elo/rating.rb, line 19
def result
  @r1 - @r1 + @k_factor * (@actual - @estimation)
end