diff options
author | guntasgrewal <guntasgrewal@gmail.com> | 2014-04-27 20:47:42 -0400 |
---|---|---|
committer | guntasgrewal <guntasgrewal@gmail.com> | 2014-04-27 20:47:42 -0400 |
commit | 4d47e5e7b5d838173dd3ab68c293c03e03811392 (patch) | |
tree | 594659a4fbc6cbc1afd188f94f8196e203cabe31 /lib/seeding/fair_ranked_seeding.rb | |
parent | df1cda1faab97f4c424efdcf8b6822f98b73adb8 (diff) | |
parent | 9d0be853cef35412c0bfe92c80502fd9da7947f1 (diff) |
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'lib/seeding/fair_ranked_seeding.rb')
-rw-r--r-- | lib/seeding/fair_ranked_seeding.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/seeding/fair_ranked_seeding.rb b/lib/seeding/fair_ranked_seeding.rb index 4eb8c26..f56d648 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_matches(tournament) + module FairRankedSeeding + def self.seed(tournament_stage) matches = tournament.current_stage.matches match = matches.first match_num = 0 @@ -19,17 +19,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 @@ -37,4 +37,4 @@ module Seeding score end end -end
\ No newline at end of file +end |