summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-04-22 19:12:31 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-04-22 19:12:31 -0400
commit3e86ffe1113a096541ea94567bffee79368fb863 (patch)
tree7e531c0fa074f744fc21dbc06b38de6b0cae5efe /lib
parent42aa0fe7fdfc51f79cda90c4d71621a797995a6c (diff)
Added Pairing Algorithms
Diffstat (limited to 'lib')
-rw-r--r--lib/pairing/PairingAlgorithm.rb2
-rw-r--r--lib/scheduling/elimination.rb7
-rw-r--r--lib/scoring/ScoringAlgorithm.rb10
3 files changed, 11 insertions, 8 deletions
diff --git a/lib/pairing/PairingAlgorithm.rb b/lib/pairing/PairingAlgorithm.rb
index c3d7f7b..81e4df6 100644
--- a/lib/pairing/PairingAlgorithm.rb
+++ b/lib/pairing/PairingAlgorithm.rb
@@ -1,4 +1,4 @@
-module Leaguer
+module Pairing
class PairingAlgorithm
def self.pair(matches, players)
end
diff --git a/lib/scheduling/elimination.rb b/lib/scheduling/elimination.rb
index e718d54..e0f8d6a 100644
--- a/lib/scheduling/elimination.rb
+++ b/lib/scheduling/elimination.rb
@@ -8,6 +8,7 @@ module Scheduling
def tournament_stage
@tournament_stage
end
+
def tournament
self.tournament_stage.tournament
end
@@ -18,10 +19,14 @@ module Scheduling
for i in 1..num_matches
self.tournament_stage.matches.create(status: 0, submitted_peer_evaluations: 0)
end
+
match_num = num_matches-1
team_num = 0
+
+ self.tournament.players.shuffle
+
# for each grouping of min_players_per_team
- self.tournament.players.each_slice(min_players_per_team) do |team_members|
+ self.tournament.players.each_slice(self.tournament.min_players_per_team) do |team_members|
# if the match is full, move to the next match, otherwise move to the next team
if (team_num == min_teams_per_match)
match_num -= 1
diff --git a/lib/scoring/ScoringAlgorithm.rb b/lib/scoring/ScoringAlgorithm.rb
index 6277da8..f2afa6f 100644
--- a/lib/scoring/ScoringAlgorithm.rb
+++ b/lib/scoring/ScoringAlgorithm.rb
@@ -1,8 +1,6 @@
-module Leaguer
- module Scoring
- class ScoringAlgorithm
- def self.score(match, interface)
- end
+module Scoring
+ class ScoringAlgorithm
+ def self.score(match, interface)
end
end
-end \ No newline at end of file
+end