From ab25aac502a768b6a530ada5c46d6aabe6a56c4c Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Sat, 26 Apr 2014 22:47:58 -0400 Subject: Added READMEs for scheduling and started seeding in lib. --- lib/scheduling/README.md | 13 +++++++++++++ lib/scheduling/elimination.rb | 25 ++++++++++++------------- lib/scheduling/roundrobin.rb | 31 +++++++++++++++++++++---------- lib/seeding/.keep | 0 lib/seeding/README.md | 3 +++ 5 files changed, 49 insertions(+), 23 deletions(-) create mode 100644 lib/scheduling/README.md create mode 100644 lib/seeding/.keep create mode 100644 lib/seeding/README.md diff --git a/lib/scheduling/README.md b/lib/scheduling/README.md new file mode 100644 index 0000000..173b7be --- /dev/null +++ b/lib/scheduling/README.md @@ -0,0 +1,13 @@ +Files in this directory should implement the following interface: + + - `initialize(tournament_stage)` + construct new Scheduling object from tournament_stage + + - `create_matches` + creates all the matches of the current round + + - `finish_match(match)` + progresses the match through the schedule + + - `graph` + returns a string representation of an svg image of the current stage \ No newline at end of file diff --git a/lib/scheduling/elimination.rb b/lib/scheduling/elimination.rb index 074cb5c..4518cff 100644 --- a/lib/scheduling/elimination.rb +++ b/lib/scheduling/elimination.rb @@ -33,8 +33,7 @@ module Scheduling end end - def match_finished(match) - #what in the goddamn fuck does this mean + def finish_match(match) matches = match.tournament_stage.matches_ordered cur_match_num = matches.invert[match] unless cur_match_num == 1 @@ -55,17 +54,17 @@ module Scheduling height = [(matchHeight+50) * logBase**(depth-1) + 100, 500].max; str = <<-STRING - - - - - - - -STRING + + + + + + + + STRING base = 1 pBase = 1 (1..matches.count).each do |i| diff --git a/lib/scheduling/roundrobin.rb b/lib/scheduling/roundrobin.rb index e149860..7a9e257 100644 --- a/lib/scheduling/roundrobin.rb +++ b/lib/scheduling/roundrobin.rb @@ -14,6 +14,17 @@ module Scheduling end end + def finish_match(match) + #declare winner of match, and store that somehow + rotate + return "totes worked\n" + end + + def graph(current_user) + end + + private + def create_round_array #round robin should look like this. #NOTE: I DO NOT KNOW IF THIS IS HOW TO PROPERLY POPULATE THE ROUND ROBIN ARRAY WITH TEAMS @@ -28,15 +39,23 @@ module Scheduling end end - #this is called when a round has completed + def tournament_stage + @tournament_stage + end + + def tournament + tournament_stage.tournament + end + def rotate + #this is called when a round has completed + #remove first team hold = @team_pairs.shift #rotate by 1 element @team_pairs.rotate! #place first team the front of the array @team_pairs.unshift(hold) - end def mother_fuckin_winner @@ -50,14 +69,6 @@ module Scheduling scores[weiner] end - def match_finished(match) - #declare winner of match, and store that somehow - rotate - return "totes worked\n" - end - def graph(current_user) - - end end end diff --git a/lib/seeding/.keep b/lib/seeding/.keep new file mode 100644 index 0000000..e69de29 diff --git a/lib/seeding/README.md b/lib/seeding/README.md new file mode 100644 index 0000000..2f12622 --- /dev/null +++ b/lib/seeding/README.md @@ -0,0 +1,3 @@ +Files in this directory should implement the following interface: + +- -- cgit v1.1-4-g5e80