Skip to content

Commit

Permalink
Merge pull request #3 from jarodburchill/feat/home-away-matches
Browse files Browse the repository at this point in the history
Fairly assign home/away matches amongst players
  • Loading branch information
clux committed Jun 24, 2021
2 parents 2abe762 + 2e8949c commit efc75be
Show file tree
Hide file tree
Showing 6 changed files with 1,043 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
sudo: false
node_js:
- 4
- lts/*
- node
notifications:
email:
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,27 @@ Simply give the number of players (with an optional players array), and it will
var robin = require('roundrobin');
robin(6);
[ [ [ 1, 6 ], [ 2, 5 ], [ 3, 4 ] ],
[ [ 1, 5 ], [ 6, 4 ], [ 2, 3 ] ],
[ [ 5, 1 ], [ 6, 4 ], [ 2, 3 ] ],
[ [ 1, 4 ], [ 5, 3 ], [ 6, 2 ] ],
[ [ 1, 3 ], [ 4, 2 ], [ 5, 6 ] ],
[ [ 3, 1 ], [ 4, 2 ], [ 5, 6 ] ],
[ [ 1, 2 ], [ 3, 6 ], [ 4, 5 ] ] ]

// or with names supplied
robin(6, ['clux', 'lockjaw', 'pibbz', 'xeno', 'e114', 'eclipse']);
[ [ [ 'clux', 'eclipse' ], [ 'lockjaw', 'e114' ], [ 'pibbz', 'xeno' ] ],
[ [ 'clux', 'e114' ], [ 'eclipse', 'xeno' ], [ 'lockjaw', 'pibbz' ] ],
[ [ 'e114', 'clux' ], [ 'eclipse', 'xeno' ], [ 'lockjaw', 'pibbz' ] ],
[ [ 'clux', 'xeno' ], [ 'e114', 'pibbz' ], [ 'eclipse', 'lockjaw' ] ],
[ [ 'clux', 'pibbz' ], [ 'xeno', 'lockjaw' ], [ 'e114', 'eclipse' ] ],
[ [ 'pibbz', 'clux', ], [ 'xeno', 'lockjaw' ], [ 'e114', 'eclipse' ] ],
[ [ 'clux', 'lockjaw' ], [ 'pibbz', 'eclipse' ], [ 'xeno', 'e114' ] ] ]
```

### Home/Away Matches
In version `2.0.0` or greater, the outputted order of the match arrays denote which player is "home" or "away":
```js
[ 'away', 'home' ] // index 0 is away and index 1 is home
```
This can be used to indicate home/away in sports, white/black in chess, etc.

## Installation
Install from npm:

Expand Down

0 comments on commit efc75be

Please sign in to comment.