round_robin_tournament 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f65f228a5f469fd5296bc574bfaa98e98462dd4a
4
- data.tar.gz: adfbeb6ce95ef9b3bbbb7ed7310b1864563c83fa
2
+ SHA256:
3
+ metadata.gz: 602722f9a01df5d8ac2c4d6fa8891ba4af1c24fb7420411af5f7b7e9a1914858
4
+ data.tar.gz: f6bcabe982701d5a4a2dece4b9b4368d1c5dba3d1e1e1b79ecc1fd83295ec13d
5
5
  SHA512:
6
- metadata.gz: 9ef29e4835a407c5de6f39a4db7725bc29bf88f6677656a410c84faad0ecb441b2d85e804373d089c7143553a7583d467e0b2089e0f510a3f100e16a6bc24997
7
- data.tar.gz: 63a6bbeddbde24e1a366f56ddebaef6f0054d9c63be2a75d9f0d9b58e6045dabd329f5b35a955f314a450d2bb04c42fd73c4dc44d0b9c57baa97bdb612202d09
6
+ metadata.gz: 5fc2438012012087bb18d08236be7f04fb76bb06a644947833168d0c75fd7effe34ed1abfcab50756c8a631000dd5b3b3000332af6783dc7b5b97f1d9eb41b87
7
+ data.tar.gz: c46981d03da742a33febcc0c1dfaa8ad174cf2bdde1782c28d3a21cac340e82709d9b791b74fbe04c2099c079be8f446e37c073c8752326aef3d5d441e3525da
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ *.gem
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Build Status](https://travis-ci.org/ssaunier/round_robin_tournament.svg?branch=master)](https://travis-ci.org/ssaunier/round_robin_tournament)
2
+ [![Gem Version](https://badge.fury.io/rb/round_robin_tournament.svg)](http://rubygems.org/gems/round_robin_tournament)
2
3
 
3
4
  # Round Robin Tournament
4
5
 
@@ -6,6 +7,10 @@ This little ruby gem implements the [Round Robin Tournament](http://en.wikipedia
6
7
  "in which each contestant meets all other contestants in turn", or if you have a classroom
7
8
  of students and want them to work in pairs, but with a different partner every day.
8
9
 
10
+ ## Upgrade
11
+
12
+ If you upgrade from version `0.0.1` to `0.1.0`, the tournament rotation has been reversed, which brings **stability** on first day pairs for a growing number for participants.
13
+
9
14
  ## Installation
10
15
 
11
16
  Add this line to your application's Gemfile:
@@ -67,4 +72,9 @@ end
67
72
  # Day 3: (George, ), (OtherGuy, Ringo), (John, Paul)
68
73
  # Day 4: (OtherGuy, ), (John, George), (Paul, Ringo)
69
74
  # Day 5: (John, ), (Paul, OtherGuy), (Ringo, George)
70
- ```
75
+ ```
76
+
77
+ ## Credits
78
+
79
+ I'd like to thank [Pierre-Olivier Goffard](http://pierre-olivier.goffard.me/),
80
+ Joel Cohen and Florent Rovetta from the [*Institut de Mathématiques de Marseille*](http://iml.univ-mrs.fr/) who helped a lot!
@@ -5,7 +5,7 @@ module RoundRobinTournament
5
5
  def self.schedule(array)
6
6
  array.push nil if array.size.odd?
7
7
  n = array.size
8
- pivot = array.pop
8
+ pivot = array.shift
9
9
  games = (n - 1).times.map do
10
10
  array.rotate!
11
11
  [[array.first, pivot]] + (1...(n / 2)).map { |j| [array[j], array[n - 1 - j]] }
@@ -1,3 +1,3 @@
1
1
  module RoundRobinTournament
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -20,6 +20,20 @@ describe RoundRobinTournament do
20
20
  teams = RoundRobinTournament.schedule(students)
21
21
  expect { check_schedule!(teams) }.not_to raise_error
22
22
  end
23
+
24
+ it 'is stable growing the number of participants by 1' do
25
+ day_four = RoundRobinTournament.schedule(%w[a b c d]).first
26
+ day_five = RoundRobinTournament.schedule(%w[a b c d e]).first
27
+ expect(day_five[0..1]).to eq(day_four)
28
+ expect(day_five.last).to eq(['e', nil])
29
+ end
30
+
31
+ it 'is stable growing the number of participants by 2' do
32
+ day_four = RoundRobinTournament.schedule(%w[a b c d]).first
33
+ day_six = RoundRobinTournament.schedule(%w[a b c d e f]).first
34
+ expect(day_six[0..1]).to eq(day_four)
35
+ expect(day_six.last).to eq(['e', 'f'])
36
+ end
23
37
  end
24
38
 
25
39
  def check_schedule!(schedule)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: round_robin_tournament
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastien Saunier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-12 00:00:00.000000000 Z
11
+ date: 2020-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.4.2
93
+ rubygems_version: 3.0.3
95
94
  signing_key:
96
95
  specification_version: 4
97
96
  summary: Round Robin Tournament schedule for competitions or classroom teams