-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a short description of the project to the readme file for better display on GitHub. Also adding a first example how to use go module by using `GenerateRoundRobinTournamentMatchesByNumber()`.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# round robin tournament | ||
|
||
This is a golang module which will provide functions to generate a 2d slice of string containing matches of given teams. | ||
The matches will be generated using the [round-robin tournament](https://en.wikipedia.org/wiki/Round-robin_tournament). | ||
Every team will play against every other team. | ||
|
||
## example | ||
|
||
The following golang function call will create the 2d slice of strings above. | ||
```go | ||
GenerateRoundRobinTournamentMatchesByNumber(4) | ||
``` | ||
|
||
``` | ||
[ | ||
[Team 1 Team 2] | ||
[Team 3 Team 4] | ||
[Team 1 Team 4] | ||
[Team 2 Team 3] | ||
[Team 1 Team 3] | ||
[Team 4 Team 2] | ||
] | ||
``` | ||
|
||
You will find other examples in [example](example) directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/taskmedia/roundrobintournament" | ||
) | ||
|
||
func main() { | ||
matches := roundrobintournament.GenerateRoundRobinTournamentMatchesByNumber(4) | ||
|
||
for i, match := range matches { | ||
fmt.Printf("match #%d: %s : %s\n", i+1, match[0], match[1]) | ||
} | ||
} |