From 86992e85220e9a42ed498497ca733e39fb7266fc Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Thu, 24 Apr 2014 21:46:10 -0400 Subject: seeds and elimination small changes --- lib/scheduling/elimination.rb | 17 +++++++++-------- lib/scheduling/roundrobin.rb | 24 ++++++++++++++++++++++++ lib/scoring/ScoringAlgorithm.rb | 6 ++++++ 3 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 lib/scheduling/roundrobin.rb create mode 100644 lib/scoring/ScoringAlgorithm.rb (limited to 'lib') diff --git a/lib/scheduling/elimination.rb b/lib/scheduling/elimination.rb index 0e93f7a..543df52 100644 --- a/lib/scheduling/elimination.rb +++ b/lib/scheduling/elimination.rb @@ -7,14 +7,6 @@ module Scheduling @tournament_stage = tournament_stage end - def tournament_stage - @tournament_stage - end - - def tournament - self.tournament_stage.tournament - end - def create_matches num_teams = (self.tournament.players.count/self.tournament.min_players_per_team).floor num_matches = (Float(num_teams - tournament.min_teams_per_match)/(tournament.min_teams_per_match - 1)).ceil + 1 @@ -138,5 +130,14 @@ STRING return str end + private + + def tournament_stage + @tournament_stage + end + + def tournament + self.tournament_stage.tournament + end end end diff --git a/lib/scheduling/roundrobin.rb b/lib/scheduling/roundrobin.rb new file mode 100644 index 0000000..e050c41 --- /dev/null +++ b/lib/scheduling/roundrobin.rb @@ -0,0 +1,24 @@ + +module Scheduling + class RoundRobin + include Rails.application.routes.url_helpers + + def initialize(tournament_stage) + @tournament_stage = tournament_stage + end + + def create_matches + num_teams = (self.tournament.players.count/self.tournament.min_players_per_team).floor + num_matches = Float(num_teams/2)*(num_teams-1) + + end + + def match_finished(match) + + end + + def graph(current_user) + + end + end +end diff --git a/lib/scoring/ScoringAlgorithm.rb b/lib/scoring/ScoringAlgorithm.rb new file mode 100644 index 0000000..f2afa6f --- /dev/null +++ b/lib/scoring/ScoringAlgorithm.rb @@ -0,0 +1,6 @@ +module Scoring + class ScoringAlgorithm + def self.score(match, interface) + end + end +end -- cgit v1.2.3-2-g168b