Documentation ¶
Index ¶
Constants ¶
View Source
const DropDiscCmd cg.CommandName = "drop_disc"
The `drop_disc` command can be sent to drop a disc into the game grid. Only allowed when it is the current player's turn.
View Source
const GameOverEvent cg.EventName = "game_over"
View Source
const GridEvent cg.EventName = "grid"
The game grid.
View Source
const InvalidActionEvent cg.EventName = "invalid_action"
The 'invalid_action' event notifies the player that their action was not allowed.
View Source
const PopOutCmd cg.CommandName = "pop_out"
The `pop_out` command can be sent to remove a disc of your color from the bottom of the grid. Only available if config.variation = pop_out.
View Source
const StartEvent cg.EventName = "start"
The `start` event is sent to all players when the game begins.
View Source
const TurnEvent cg.EventName = "turn"
The `turn` event is sent to all players when it is the next player's turn.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DropDiscCmdData ¶
type DropDiscCmdData struct { // 0 <= column < config.width Column int `json:"column"` }
type GameConfig ¶
type GameConfig struct { // The width of the game grid. min = 3, default = 7 Width int `json:"width"` // The height of the game grid. min = 3, default = 6 Height int `json:"height"` // The number of discs, which form a winning line. min = 2, default = 4 WinLength int `json:"win_length"` // The rule variation to use. default: original Variation Variation `json:"variation"` }
type GameOverEventData ¶
type GridEventData ¶
type GridEventData struct { // The cells of the grid as columns (left to right) inside of rows (top to bottom). Cells [][]Cell `json:"cells"` }
type InvalidActionEventData ¶
type InvalidActionEventData struct { // The message containing details on what the player did wrong. Message string `json:"message"` }
type PopOutCmdData ¶
type PopOutCmdData struct { // 0 <= column < config.width Column int `json:"column"` }
type StartEventData ¶
type TurnEventData ¶
type TurnEventData struct { // The sign of the player whose turn it is now. Color Color `json:"color"` }
Click to show internal directories.
Click to hide internal directories.