Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ndPPPhz committed Feb 5, 2021
1 parent 75858bf commit 9bf8c97
Showing 1 changed file with 85 additions and 1 deletion.
86 changes: 85 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,86 @@
# Fixture-Generator
Random Matches Fixture Generator
![foot-ball-icons](https://user-images.githubusercontent.com/6486741/107073907-dabb2d80-67df-11eb-8382-30d4431732b5.png)

The matches **calendar generator** you have been looking for

## Overview
Fixture-Generator is a fancy, quick and random generator of matches you can import in your JS code to create a football league, basketball tournament or any other sport in which all the partecipants have to challenge each other.

Under the hood is driven by the [Round-robin](https://en.wikipedia.org/wiki/Round-robin_tournament) alghorithm which guarantees thah each contestant meets all other contestants in turn.

## Usage

### NPM
- Package page [fixture-generator](https://www.npmjs.com/package/fixture-generator)
- Run the command
```
npm install fixture-generator
```


### Manual integration
- Download the source code [from Github](https://github.com/ndPPPhz/Fixture-Generator/archive/main.zip)
- Import it into your project
```javascript
const { generateRandomFixture } = require('.roundrobin.js')

/*
@param {Array} array The array containing all the attendees
@param {Number} n The number of tournaments that needs to be randomly generated
*/
const tournaments = generateRandomFixture([1,2,3,4], 2)

console.log(tournaments)

/*
[
[
{
"MatchDay 0": [
{
teamA: 1,
teamB: 3,
},
{
teamA: 2,
teamB: 4,
},
],
},
{
"MatchDay 1": [
{
teamA: 1,
teamB: 2,
},
{
teamA: 4,
teamB: 3,
},
],
},
{
"MatchDay 2": [
{
teamA: 1,
teamB: 4,
},
{
teamA: 3,
teamB: 2,
},
],
},
],
[ ...... ]
*/

```


## License

[![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org)

**[MIT license](http://opensource.org/licenses/mit-license.php)**
- Copyright 2020 © Annino De Petra

0 comments on commit 9bf8c97

Please sign in to comment.