models

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsByeGame

func IsByeGame(g Game, advance int) bool

IsByeGame determines if a game should be a bye, and is determined if more real teams are participating than would advance from the game

func IsByeTeam

func IsByeTeam(t Team) bool

IsByeTeam determines if a team is a bye team. StorageEngines may indicate this by either a nil team, or a team with no players

Types

type Arena

type Arena interface {
	GetName() string
	GetGames() []Game
}

Arena is a place for the events to be held at

type Competition

type Competition interface {
	AddTournament(name string, tournamentType TournamentType, teams []Team, seeded bool, gameSize uint32, advancing uint32, scored bool) Tournament
	GetActiveTournament() Tournament
	CreateArena(name string) Arena
	GetAllTournaments() []Tournament
	GetArenas() []Arena
	GetName() string
}

Competition is the broadest category here. It can contain multiple tournaments As an example, a competition could consist of a regular round robin season followed by a single elimination tournament

type Game

type Game interface {
	GetTeams() []Team
	GetStatus() Status
	SetStatus(Status)
	SetScores([]int64) //map of teamIds to scores // Or should I map team names to scores?
	SetPlaces([]int64) //map of teamIds to places (Only should be called if game is not scored)
	SetFinal()         // Game is over, lock in whatever scores/places are in place
	GetArena() Arena
	SetArena(Arena)
	Start()
	GetBracket() string
	SetBracket(string)
	IsScored() bool
	GetScores() []int64
	GetPlaces() []int64

	GetTeamPlace(t Team) int64
	GetTeamScore(t Team) int64
}

Game is a single competitive event

type Player

type Player interface {
	GetName() string
	SetMetadata([]byte)  //store images in here
	GetMetadata() []byte // Store Images in here
	GetRecords() []Game
}

Player is part of a competition, and can be on teams that participate in competitions

type Round

type Round interface {
	CreateGame(teams []Team, scored bool) Game
	GetGames() []Game
	SetFinal() // Round is over, set all games to final/complete & lock in whatever scores/places are in place
	Start()
	SetStatus(Status)
	GetStatus() Status
}

Round is a single round within a tournament

type Status

type Status int32

Status is the basic status for tournaments, rounds, and games

const (
	Status_NEW       Status = 0
	Status_ONGOING   Status = 1
	Status_COMPLETED Status = 2
)

type StorageEngine

type StorageEngine interface {
	CreateCompetition(name string, players []Player) Competition
	CreatePlayer(name string, metadata []byte) Player

	GetCompetitions() []Competition
	GetPlayers() []Player
	GetPlayer(name string) Player
}

StorageEngine is a backing that provides storing details for an active competition

type Team

type Team interface {
	GetPlayers() []Player
	GetName() string
	SetMetadata([]byte)  //store images in here
	GetMetadata() []byte // Store images in here
	GetRecords() []Game
	Equals(Team) bool
}

Team is a participant in a Game, that is part of a competition

type Tournament

type Tournament interface {
	NextRound() (Round, error)
	StartRound()
	GetActiveRound() Round
	GetAllRounds() []Round
	GetName() string
	GetType() TournamentType
	SetMetadata([]byte)        //store match times in here
	GetMetadata() []byte       //store match times in here
	GetBracketOrder() []string // Get Display/importance order of brackets
	GetTeams() []Team
	IsScored() bool
	CreateTeam(name string, players []Player, metadata []byte) Team //If no players are provided, the team will be used as a BYE team
	GetGameSize() uint32
	IsSeeded() bool
	GetAdvancing() uint32
	SetStatus(Status)
	GetStatus() Status
	SetFinal()
	GetTeam(name string) Team
}

Tournament provides a single competitive type of event, all rankings/matches are of the same type within the tournament

type TournamentType

type TournamentType int32

Tournament type is used to discern between different competition types. Both Elimination and Regular season type competitions are supported

const (
	TournamentType_SINGLE_ELIMINATION TournamentType = 0
	TournamentType_DOUBLE_ELIMINATION TournamentType = 1
	TournamentType_ROUND_ROBIN        TournamentType = 2
	TournamentType_COMPASS_DRAW       TournamentType = 3
	TournamentType_SWISS_FORMAT       TournamentType = 4
	TournamentType_GROUP_PLAY         TournamentType = 5
)

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL