tournament-system 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c0d51a4fcebbc88d39dfa086acb16f1dc16360b
4
- data.tar.gz: da0471359dc5f85ecc551a2ce3e8136b0090bd75
3
+ metadata.gz: 658d99ded4876bcc1c1ec78dbb38066d3dfae06a
4
+ data.tar.gz: 9a11ee1ed63be549fc09d2c6f40165a316188949
5
5
  SHA512:
6
- metadata.gz: c3b7e6f7165e6713e68b7c8a18217ebf3dd1d984ecb362ef4dfa47d6cb7f49a4a78c08ce117027681599124a5f6646b65e23223f5184774ad233f9bcd9a4c05c
7
- data.tar.gz: a45707695701c74e6c779eb9d248703f2fbcbbc78aa559d0582b19f144914e03b574a1d020dd8f941de2f3b58b9a544103682edc6aca32234667e1257d67cefe
6
+ metadata.gz: c355fa4f8edfeb89e524b613cf98e66ab551f3cfe773690a039d3d7996342eab2556e151a69fc775226d11a0819cbe7660685b985f1576fcf44998a6642113f8
7
+ data.tar.gz: d5abd06fb557db3adf12c9de53d19fbfa7097c198d0b637a6a4a7a37b1ea9826ec08cabe8a1944609c2b5a3db35e67c320f7a512f41aa4fce11a4e9fa8643f60
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/ozfortress/tournament-system.svg?branch=master)](https://travis-ci.org/ozfortress/tournament-system)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/ozfortress/tournament-system/badge.svg?branch=master)](https://coveralls.io/github/ozfortress/tournament-system?branch=master)
5
+ [![Gem Version](https://badge.fury.io/rb/tournament-system.svg)](https://badge.fury.io/rb/tournament-system)
5
6
 
6
7
  This is a simple gem that implements numerous tournament systems.
7
8
 
@@ -34,6 +35,10 @@ and the tournament systems:
34
35
 
35
36
  ```ruby
36
37
  class Driver < Tournament::Driver
38
+ def matches
39
+ ...
40
+ end
41
+
37
42
  def matches_for_round(round)
38
43
  ...
39
44
  end
@@ -7,6 +7,11 @@ module Tournament
7
7
  class Driver
8
8
  # rubocop:disable Lint/UnusedMethodArgument
9
9
 
10
+ # Get all matches
11
+ def matches
12
+ raise 'Not Implemented'
13
+ end
14
+
10
15
  # Get the matches played for a particular round
11
16
  def matches_for_round(round)
12
17
  raise 'Not Implemented'
@@ -23,13 +23,22 @@ module Tournament
23
23
  private
24
24
 
25
25
  def seed_teams(teams, options)
26
- padding = 2**total_rounds_for_teams(teams) - teams.length
27
- teams = [nil] * padding + teams
26
+ teams = padd_teams teams
28
27
 
29
28
  seeder = options[:seeder] || Seeder::SingleBracket
30
29
  seeder.seed teams
31
30
  end
32
31
 
32
+ def padd_teams(teams)
33
+ # Insert the padding after the top half of the total number of teams
34
+ total = 2**total_rounds_for_teams(teams)
35
+ half = total / 2
36
+
37
+ padding = total - teams.length
38
+
39
+ teams[0...half] + [nil] * padding + teams[half...teams.length]
40
+ end
41
+
33
42
  def total_rounds_for_teams(teams)
34
43
  team_count = teams.length
35
44
 
@@ -1,3 +1,3 @@
1
1
  module Tournament
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tournament-system
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Schaaf
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler