Documentation ¶
Overview ¶
Package game contains communication structures for the game controller, lobby, and socket to use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // CheckOnSnag is a flag to check the board when a player wants to snag to ensure their board has on group of valid words. CheckOnSnag bool `json:"checkOnSnag,omitempty"` // Penalize is a flag to decrement a player's points if they try to snag a tile when their board is invalid. Penalize bool `json:"penalize,omitempty"` // ProhibitDuplicates is a flag for whether or not duplicate words are prohibited when checking the board. ProhibitDuplicates bool `json:"prohibitDuplicates,omitempty"` // MinLength is the minimum allowed word length for each word on the board. MinLength int `json:"minLength,omitempty"` }
Config is used when checking player words on a snag or game finish request.
type Info ¶
type Info struct { // ID is unique among the other games that currently exist. ID ID `json:"id,omitempty"` // Status is the state of the game. Status Status `json:"status,omitempty"` // Board is the board of the game for the player. Also used to send new movements of tiles. Board *board.Board `json:"board,omitempty"` // TilesLeft is the number of tiles left that players do not have. TilesLeft int `json:"tilesLeft,omitempty"` // Players is a list of the names of players in the game. Players []string `json:"players,omitempty"` // CreatedAt is the game's creation time in seconds since the unix epoch. CreatedAt int64 `json:"createdAt,omitempty"` // Config is the specific options used to create the game. Config *Config `json:"config,omitempty"` // FinalBoards is used to describe the state of all player's boards when a game is finished. FinalBoards map[string]board.Board `json:"finalBoards,omitempty"` // Capacity is the maximum number of players that can play the game Capacity int `json:"capacity,omitempty"` }
Info contains information about a game.
func (Info) CanJoin ¶
CanJoin indicates whether or not a player can join the game. Players can only join games that are not started or that they were previously a part of, assuming there is room.
func (Info) CapacityRatio ¶
CapacityRatio computes the capacity ratio of the game as a string.
type Status ¶
type Status int
Status is the state of the game.
const ( // NotStarted is the status of a game that is waiting for mor players to join before allowing them to rearrange their tiles. NotStarted Status // InProgress is the status of a game that has been started but is not finished. InProgress // Finished is the status of a game that has no tiles left and has a winner that has used all his tiles to form one group of interconnected words. Finished // Deleted is the status of a game that has been deleted from the server. Deleted )
Directories ¶
Path | Synopsis |
---|---|
Package board stores the tiles for a game and handles queries to read and update tiles
|
Package board stores the tiles for a game and handles queries to read and update tiles |
Package message contains structures to pass between the ui and server.
|
Package message contains structures to pass between the ui and server. |
Package player identifies game players.
|
Package player identifies game players. |
Package tile contains structures that players interact with on game boards.
|
Package tile contains structures that players interact with on game boards. |
Package word handles checking words in the game.
|
Package word handles checking words in the game. |
Click to show internal directories.
Click to hide internal directories.