Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clients ¶
Clients maps websocket connections to players
func (Clients) GetPlayers ¶
GetPlayers returns a slice of all the players' names
func (Clients) GetWinners ¶
GetWinners returns a slice of the winner(s) of the game, if any
type Gamewinners ¶
type Gamewinners struct {
Winners string `json:"winners"`
}
Gamewinners JSON encodes the list of winners
type Player ¶
type Player struct { Answer string `json:"answer"` Name string `json:"name"` Color string `json:"color"` Score int `json:"score"` }
Player holds info on each player: last answer, name, color, and score
func InitPlayer ¶
InitPlayer initializes a player struct
func (Player) UpdatePlayerAnswer ¶
UpdatePlayerAnswer takes a player and their sanitized but otherwise unprocessed answer (as they entered it) and returns a new updated player
type PlayerJSON ¶
type PlayerJSON struct {
Player Player `json:"player"`
}
PlayerJSON adds a player key to the resulting JSON to ease parsing on the front end
type Players ¶
type Players struct {
Players []Player `json:"players"`
}
Players lists all players to populate the scoreboard
func (Players) FormatWinners ¶
func (ps Players) FormatWinners() (gw Gamewinners)
FormatWinners builds a string of winners' names and returns it in a struct