blob: e2db2cfc47acd53dec17a4e66d7e030950db807a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
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 = (num_teams* Float(num_teams-1)/2).ceil
#round robin should look like this
@team_pairs = Array.new(num_matches)
for i in 0..@match.teams.size
@team_pairs.push(@match.teams[i])
end
#team_pairs needs populated with the team objects and im not sure how to do that
end
#this is called when a round has completed
def rotate
hold = @team_pairs.shift
@team_pairs.rotate!
@team_pairs.unshift(hold)
# for j in 0..4
# puts "#{array[j]}, #{array[j+(array.size/2)-1]}"
# end
# puts "\n\n"
end
def match_finished(match)
end
def graph(current_user)
end
end
end
|