Class: EloBrain::Matches::Services::LaunchNewEloCalculation

Inherits:
Object
  • Object
show all
Defined in:
lib/elo_brain/matches/services/launch_new_elo_calculation.rb

Instance Method Summary collapse

Instance Method Details

#call(strategy:, nb_matches:, player_elo:, opponent_elo:) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/elo_brain/matches/services/launch_new_elo_calculation.rb', line 7

def call(strategy:, nb_matches:, player_elo:, opponent_elo:)
  coefficient = development_coefficient(nb_matches, player_elo)
  probability = win_probability(player_elo - opponent_elo)
  calculation_strategy(strategy).new_elo(
    elo: player_elo,
    development_coefficient: coefficient,
    win_probability: probability
  )
end