Class: EloBrain::Matches::Match
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- EloBrain::Matches::Match
- Defined in:
- lib/elo_brain/matches/match.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from(player1:, player2:) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/elo_brain/matches/match.rb', line 9 def self.from(player1:, player2:) new( player1: player1, player2: player2 ) end |
.from_contract(contract:) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/elo_brain/matches/match.rb', line 16 def self.from_contract(contract:) new( player1: contract[:player1], player2: contract[:player2] ) end |
Instance Method Details
#calculate_new_elos ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/elo_brain/matches/match.rb', line 23 def calculate_new_elos { player1_new_elo: EloBrain::Matches::Services::LaunchNewEloCalculation.new.call( strategy: player1.situation, nb_matches: player1.nb_matches, player_elo: player1.elo, opponent_elo: player2.elo ), player2_new_elo: EloBrain::Matches::Services::LaunchNewEloCalculation.new.call( strategy: player2.situation, nb_matches: player2.nb_matches, player_elo: player2.elo, opponent_elo: player1.elo ), } end |