Class: ActiveGenie::Ranker::Tournament
- Inherits:
-
BaseModule
- Object
- BaseModule
- ActiveGenie::Ranker::Tournament
- Defined in:
- lib/active_genie/ranker/tournament.rb
Constant Summary collapse
- ELIMINATION_VARIATION =
'variation_too_high'- ELIMINATION_RELEGATION =
'relegation_tier'
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(players, criteria, juries: [], config: {}) ⇒ Tournament
constructor
A new instance of Tournament.
Methods inherited from BaseModule
Constructor Details
#initialize(players, criteria, juries: [], config: {}) ⇒ Tournament
Returns a new instance of Tournament.
34 35 36 37 38 39 |
# File 'lib/active_genie/ranker/tournament.rb', line 34 def initialize(players, criteria, juries: [], config: {}) @players = Entities::Players.new(players) @criteria = criteria @juries = Array(juries).compact.uniq super(config:) end |
Instance Method Details
#call ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/active_genie/ranker/tournament.rb', line 41 def call set_initial_player_scores! eliminate_obvious_bad_players! while @players.elo_eligible? elo_result = run_elo_round! eliminate_lower_tier_players! rebalance_players!(elo_result) end run_free_for_all! ActiveGenie::Result.new( data: sorted_players.map(&:content), metadata: @players.map(&:to_h) ) end |