| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A simple and flexible Go library for creating and managing single-elimination tournament brackets. This project also includes a fully interactive command-line application to run a tournament from start to finish.
This project provides two main components:
A Go Library: A set of data models and functions that you can import into your own Go applications to handle tournament logic programmatically. It correctly calculates rounds, match-ups, and byes for any number of participants.
An Interactive CLI: A runnable application (main.go) that uses the library to provide a step-by-step command-line interface.
You can enter participant names, and the app will generate a bracket and then prompt you for the winner of each match until a champion is crowned.
To use this package in your own Go project, you can install it with go get:
go get github.com/fezcode/go-tournament-brackets
Then, you can import and use it in your code:
package main
import (
"fmt"
"github.com/fezcode/go-tournament-brackets"
)
func main() {
participants := []string{"Team Alpha", "Team Bravo", "Team Charlie", "Team Delta", "Team Echo"}
// Create a new tournament
tourney, err := tournament.NewTournament("My Cup", tournament.SingleElimination, participants, nil)
if err != nil {
panic(err)
}
// Print the initial bracket state
tourney.PrintAscii()
// From here, you can programmatically set winners and advance them
// For example, to set Team Alpha (ID: 1) as the winner of their first match:
// tourney.SetWinner(roundIndex, matchIndex, 1)
}| Back | FazBrowse Home | New Git URL |