Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Game ¶
type Game struct { gorm.Model sttt.Game JoinID string `gorm:"unique"` // The joining key that players use to pair manually Player1ID int Player1 User // "X" Player2ID int Player2 User // "O" WinnerID int Winner User State State StartTime time.Time Duration time.Duration Password string }
Game wraps the sttt Game class, providing some extra information for our use, like what userids are participating. It does _not_ save the full game state; that's just saved in memory. We only hit the database when saving a completed game.
type State ¶
type State int
State describes what state the game is in
const ( // InProgress describes a game that has been created, but not won or tied. InProgress State = iota // Won represents a game that either one player won, or the other player // resigned. Won // Abandoned references a game that is not won, but is more than a month // old. Abandoned // Tied references a game that has been played into such a state that // neither player can win. For example, if the top level grid is // X | O | // ---+---+--- // O | | X // ---+---+--- // | X | O // then no matter who takes the last three squares, nobody can attain three // top-level squares in a row. Tied )
Click to show internal directories.
Click to hide internal directories.