summaryrefslogtreecommitdiff
path: root/lib/seeding/fair_ranked_seeding.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/seeding/fair_ranked_seeding.rb')
-rw-r--r--lib/seeding/fair_ranked_seeding.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/seeding/fair_ranked_seeding.rb b/lib/seeding/fair_ranked_seeding.rb
index 6531c43..6bc62ca 100644
--- a/lib/seeding/fair_ranked_seeding.rb
+++ b/lib/seeding/fair_ranked_seeding.rb
@@ -1,6 +1,6 @@
module Seeding
- class FairRankedSeeding
- def seed(tournament_stage)
+ module FairRankedSeeding
+ def self.seed(tournament_stage)
matches = tournament.current_stage.matches
match = matches.first
match_num = 0
@@ -22,17 +22,17 @@ module Seeding
end
private
- def best_first(tournament)
+ def self.best_first(tournament)
tournament.players.sort {|a, b| better(a, b, tournament) }
end
- def better(player1, player2, tournament)
- ps1 = previousScore(player1, tournament)
- ps2 = previousScore(player2, tournament)
+ def self.better(player1, player2, tournament)
+ ps1 = previous_score(player1, tournament)
+ ps2 = previous_score(player2, tournament)
ps1 <=> ps2
end
- def previousScore(player, tournament)
+ def self.previous_score(player, tournament)
score = tournament.statistics.getStatistic(player.matches.last, player, :score)
if score.nil?
return 0
@@ -40,4 +40,4 @@ module Seeding
score
end
end
-end \ No newline at end of file
+end