diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-04-24 21:55:57 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-04-24 21:55:57 -0400 |
commit | 3a87a43fb993c08b780be484fa3d89bc3c568e64 (patch) | |
tree | 32782f4a2a11beb35598b434f9ddce9b88d2eeb9 | |
parent | e1ef99a9ade5723c7bc65977546b4e1fdaab9688 (diff) | |
parent | 86992e85220e9a42ed498497ca733e39fb7266fc (diff) |
Merge branch 'master' of http://github.com/LukeShu/leaguer
-rw-r--r-- | db/seeds.rb | 36 | ||||
-rw-r--r-- | lib/scheduling/elimination.rb | 17 | ||||
-rw-r--r-- | lib/scheduling/roundrobin.rb | 24 | ||||
-rw-r--r-- | lib/scoring/ScoringAlgorithm.rb | 6 |
4 files changed, 75 insertions, 8 deletions
diff --git a/db/seeds.rb b/db/seeds.rb index 61cf44a..7628efe 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -123,4 +123,40 @@ if Rails.env.development? end tourn5.join(players_for_league[9]) + tourn6 = Tournament.create(game_id: 1, status: 0, name: "3 teams per match", min_players_per_team: 1, max_players_per_team: 1, min_teams_per_match: 3, + max_teams_per_match: 3, set_rounds: 1, randomized_teams: true, sampling_method: nil) + + for i in 0..9 + if i == 0 + tourn6.hosts.push(players_for_league[i]) + end + tourn6.join(players_for_league[i]) + end + tourn6.join(players_for_league[9]) + tourn6.join(davis) + tourn6.join(foy) + tourn6.join(guntas) + tourn6.join(luke) + tourn6.join(marco) +=begin + hash1 = {:username => "TeslasMind", :id => id} + hash2 = {:username => "Alpha142", :id => id} + hash3 = {:username => "ImFromNasa", :id => id} + hash4 = {:username => "NalfeinX", :id => id} + hash5 = {:username => "GTBPhoenix", :id => id} + hash6 = {:username => , :id => id} + hash7 = {:username => username, :id => id} + hash8 = {:username => username, :id => id} + hash9 = {:username => username, :id => id} + hash10 = {:username => username, :id => id} + + + +FOR ROUNG ROBIN + +http://stackoverflow.com/questions/6648512/scheduling-algorithm-for-a-round-robin-tournament + + +=end + end 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 |