Documentation
¶
Index ¶
- Constants
- Variables
- func InferChildStatus(dob string, now time.Time) pb.ChildStatus
- func IsAdult(dob string, now time.Time) bool
- func LastOutstandingMetaRequest(evts []*pb.GameMetaEvent, uid string, now int64) *pb.GameMetaEvent
- func RelevantRating(ratings Ratings, ratingKey VariantKey) string
- func TotalTimeEstimate(gamereq *pb.GameRequest) int32
- func ValidateGameRequest(ctx context.Context, req *pb.GameRequest) error
- type Actions
- type AuthMethod
- type CompetitionType
- type DivisionManager
- type EventAudienceType
- type EventWrapper
- func (e *EventWrapper) AddAudience(audType EventAudienceType, suffix string)
- func (e *EventWrapper) AddExcludedUsers(ids []string)
- func (e *EventWrapper) Audience() []string
- func (e *EventWrapper) Serialize() ([]byte, error)
- func (e *EventWrapper) SetAudience(a string)
- func (e *EventWrapper) SetSerializationProtocol(protocol SerializationProtocol)
- type FakeNower
- type Game
- func (g *Game) CachedTimeRemaining(idx int) int
- func (g *Game) ChallengeRule() macondopb.ChallengeRule
- func (g *Game) CreationRequest() *pb.GameRequest
- func (g *Game) GameID() string
- func (g *Game) GetWinnerIdx() int
- func (g *Game) HistoryRefresherEvent() *pb.GameHistoryRefresher
- func (g *Game) NewActiveGameEntry(gameStillActive bool) *EventWrapper
- func (g *Game) RatingKey() (VariantKey, error)
- func (g *Game) RatingMode() pb.RatingMode
- func (g *Game) RecordTimeOfMove(idx int)
- func (g *Game) RegisterChangeHook(eventChan chan<- *EventWrapper) error
- func (g *Game) ResetTimersAndStart()
- func (g *Game) SendChange(e *EventWrapper)
- func (g *Game) SetGameEndReason(r pb.GameEndReason)
- func (g *Game) SetLoserIdx(pidx int)
- func (g *Game) SetTimerModule(n Nower)
- func (g *Game) SetWinnerIdx(pidx int)
- func (g *Game) TimeRanOut(idx int) bool
- func (g *Game) TimeRemaining(idx int) int
- func (g *Game) TimeStarted() int64
- func (g *Game) TimerModule() Nower
- func (g *Game) WinnerWasSet() bool
- type GameHistory
- type GameRequest
- type GameTimer
- type IncrementType
- type ListDatum
- type ListItem
- type MetaEventData
- type MistakeMagnitude
- type MistakeType
- type Nower
- type PoolMember
- type Profile
- type ProfileStats
- type Quickdata
- type Ratings
- type SerializationProtocol
- type Session
- type SingleRating
- type SoughtGame
- func (sg *SoughtGame) ID() (string, error)
- func (sg *SoughtGame) ReceiverConnID() (string, error)
- func (sg *SoughtGame) ReceiverDisplayName() (string, error)
- func (sg *SoughtGame) ReceiverIsPermanent() (bool, error)
- func (sg *SoughtGame) ReceiverUserID() (string, error)
- func (sg *SoughtGame) Scan(value interface{}) error
- func (sg *SoughtGame) SeekerConnID() (string, error)
- func (sg *SoughtGame) SeekerUserID() (string, error)
- func (sg *SoughtGame) Value() (driver.Value, error)
- type SoughtGameType
- type StatItem
- type StatItemType
- type Stats
- type TimeControl
- type Timers
- type Tournament
- type TournamentData
- type TournamentDivision
- type TournamentMeta
- type TournamentType
- type UnpairedPoolMembers
- type User
- func (u *User) AvatarUrl() string
- func (u *User) GetProtoRatings() (map[string]*pb.ProfileUpdate_Rating, error)
- func (u *User) GetRating(ratingKey VariantKey) (*SingleRating, error)
- func (u *User) GetRelevantRating(ratingKey VariantKey) string
- func (u *User) IsChild() pb.ChildStatus
- func (u *User) RealName() string
- func (u *User) RealNameIfNotYouth() string
- func (u *User) TournamentID() string
- type UserPermission
- type Variant
- type VariantKey
- type WooglesError
Constants ¶
const ( // MaxNameLength is the maximum length that a proto message can be. MaxNameLength = 64 DefaultSerializationProtocol = EvtSerializationProtoWithHeader )
const ( AudGame EventAudienceType = "game" AudGameTV = "gametv" AudUser = "user" AudLobby = "lobby" AudTournament = "tournament" AudBotCommands = "bot.commands" // AudChannel is used for a general channel. AudChannel = "channel" )
const ( CrosswordGame string = "CrosswordGame" LargeTime int = 1000000000 )
const ( KnowledgeMistakeType = "knowledge" FindingMistakeType = "finding" VisionMistakeType = "vision" TacticsMistakeType = "tactics" StrategyMistakeType = "strategy" TimeMistakeType = "time" EndgameMistakeType = "endgame" )
const ( LargeMistakeMagnitude = "large" MediumMistakeMagnitude = "medium" SmallMistakeMagnitude = "small" SaddestMistakeMagnitude = "saddest" SadderMistakeMagnitude = "sadder" SadMistakeMagnitude = "sad" UnspecifiedMistakeMagnitude = "unspecified" )
const ( ALL_TRIPLE_LETTERS_COVERED_STAT string = "All Triple Letter Squares Covered" ALL_TRIPLE_WORDS_COVERED_STAT string = "All Triple Word Squares Covered" BINGOS_STAT string = "Bingos" CHALLENGED_PHONIES_STAT string = "Challenged Phonies" CHALLENGES_LOST_STAT string = "Challenges Lost" CHALLENGES_WON_STAT string = "Challenges Won" COMMENTS_STAT string = "Comments" DRAWS_STAT string = "Draws" EXCHANGES_STAT string = "Exchanges" FIRSTS_STAT string = "Firsts" GAMES_STAT string = "Games" HIGH_GAME_STAT string = "High Game" HIGH_TURN_STAT string = "High Turn" LOSSES_STAT string = "Losses" LOW_GAME_STAT string = "Low Game" NO_BINGOS_STAT string = "Games with no Bingos" MANY_DOUBLE_LETTERS_COVERED_STAT string = "Many Double Letter Squares Covered" MANY_DOUBLE_WORDS_COVERED_STAT string = "Many Double Word Squares Covered" MISTAKES_STAT string = "Mistakes" SCORE_STAT string = "Score" RATINGS_STAT string = "Ratings" TILES_PLAYED_STAT string = "Tiles Played" TIME_STAT string = "Time Taken" TRIPLE_TRIPLES_STAT string = "Triple Triples" TURNS_STAT string = "Turns" TURNS_WITH_BLANK_STAT string = "Turns With Blank" UNCHALLENGED_PHONIES_STAT string = "Unchallenged Phonies" VALID_PLAYS_THAT_WERE_CHALLENGED_STAT string = "Valid Plays That Were Challenged" VERTICAL_OPENINGS_STAT string = "Vertical Openings" WINS_STAT string = "Wins" NO_BLANKS_PLAYED_STAT string = "No Blanks Played" HIGH_SCORING_STAT string = "High Scoring" COMBINED_HIGH_SCORING_STAT string = "Combined High Scoring" COMBINED_LOW_SCORING_STAT string = "Combined Low Scoring" ONE_PLAYER_PLAYS_EVERY_POWER_TILE_STAT string = "One Player Plays Every Power Tile" ONE_PLAYER_PLAYS_EVERY_E_STAT string = "One Player Plays Every E" MANY_CHALLENGES_STAT string = "Many Challenges" FOUR_OR_MORE_CONSECUTIVE_BINGOS_STAT string = "Four or More Consecutive Bingos" )
const ( // TypeStandard is a standard tournament TypeStandard CompetitionType = "tournament" // TypeClub is a club/clubhouse TypeClub = "club" // TypeChild is spawned from a club or tournament TypeChild = "child" // TypeLegacy is a tournament, but in club/clubhouse mode. The only different // from a clubhouse is that it can have a /tournament URL. TypeLegacy = "legacy" )
const ( ByeScore int = 50 ForfeitScore int = -50 )
const ( AuthMethodCookie = "cookie" AuthMethodAPIKey = "apikey" )
const ( TCRegular TimeControl = "regular" // > 14/0 TCRapid = "rapid" // 6/0 to <= 14/0 TCBlitz = "blitz" // > 2/0 to < 6/0 TCUltraBlitz = "ultrablitz" // 2/0 and under TCCorres = "corres" )
const ( // Cutoffs in seconds for different time controls. CutoffUltraBlitz = 2 * 60 CutoffBlitz = 6 * 60 CutoffRapid = 14 * 60 )
const DifferencePenalty = 1
These constants control the swiss weighing function
const DifferencePenaltyMargin = 2
const MaxNotableInt = 1000000000
const MaxRelativeWeight int = 100
const ProhibitiveWeight int64 = 1 << 52
const PuzzleVariant = "puzzle"
const RatingDeviationConfidence = float64(glicko.MinimumRatingDeviation + 30)
If the RD is <= this number, the rating is "known"
const ( // SessionExpiration - Expire a session after this much time. SessionExpiration = time.Hour * 24 * 30 )
const WinWeightScaling int64 = 1 << 22
const WooglesErrorDelimiter = ";"
Variables ¶
var AllowedNewGameLexica []string
var MistakeMagnitudeAliases = map[string]string{LargeMistakeMagnitude: LargeMistakeMagnitude, MediumMistakeMagnitude: MediumMistakeMagnitude, SmallMistakeMagnitude: SmallMistakeMagnitude, UnspecifiedMistakeMagnitude: UnspecifiedMistakeMagnitude, "saddest": LargeMistakeMagnitude, "sadder": MediumMistakeMagnitude, "sad": SmallMistakeMagnitude, }
var MistakeMagnitudeMapping = map[string]int{LargeMistakeMagnitude: 1, MediumMistakeMagnitude: 2, SmallMistakeMagnitude: 3, UnspecifiedMistakeMagnitude: 0, }
var MistakeTypeMapping = map[string]int{KnowledgeMistakeType: 0, FindingMistakeType: 1, VisionMistakeType: 2, TacticsMistakeType: 3, StrategyMistakeType: 4, TimeMistakeType: 5, EndgameMistakeType: 6}
var StatName_value = map[string]int{ ALL_TRIPLE_LETTERS_COVERED_STAT: 0, ALL_TRIPLE_WORDS_COVERED_STAT: 1, BINGOS_STAT: 2, CHALLENGED_PHONIES_STAT: 3, CHALLENGES_LOST_STAT: 4, CHALLENGES_WON_STAT: 5, COMMENTS_STAT: 6, DRAWS_STAT: 7, EXCHANGES_STAT: 8, FIRSTS_STAT: 9, GAMES_STAT: 10, HIGH_GAME_STAT: 11, HIGH_TURN_STAT: 12, LOSSES_STAT: 13, LOW_GAME_STAT: 14, NO_BINGOS_STAT: 15, MANY_DOUBLE_LETTERS_COVERED_STAT: 16, MANY_DOUBLE_WORDS_COVERED_STAT: 17, MISTAKES_STAT: 18, SCORE_STAT: 19, RATINGS_STAT: 20, TILES_PLAYED_STAT: 21, TIME_STAT: 22, TRIPLE_TRIPLES_STAT: 23, TURNS_STAT: 24, TURNS_WITH_BLANK_STAT: 25, UNCHALLENGED_PHONIES_STAT: 26, VALID_PLAYS_THAT_WERE_CHALLENGED_STAT: 27, VERTICAL_OPENINGS_STAT: 28, WINS_STAT: 29, NO_BLANKS_PLAYED_STAT: 30, HIGH_SCORING_STAT: 31, COMBINED_HIGH_SCORING_STAT: 32, COMBINED_LOW_SCORING_STAT: 33, ONE_PLAYER_PLAYS_EVERY_POWER_TILE_STAT: 34, ONE_PLAYER_PLAYS_EVERY_E_STAT: 35, MANY_CHALLENGES_STAT: 36, FOUR_OR_MORE_CONSECUTIVE_BINGOS_STAT: 37, }
Functions ¶
func InferChildStatus ¶
func InferChildStatus(dob string, now time.Time) pb.ChildStatus
func LastOutstandingMetaRequest ¶
func LastOutstandingMetaRequest(evts []*pb.GameMetaEvent, uid string, now int64) *pb.GameMetaEvent
LastOutstandingMetaRequest returns the last meta request that has not yet been responded to. If a user ID is passed in, it only returns that user's last request, if it exists. If no such event exists, it returns nil.
func RelevantRating ¶
func RelevantRating(ratings Ratings, ratingKey VariantKey) string
RelevantRating returns the rating from a Ratings object given a rating key.
func TotalTimeEstimate ¶
func TotalTimeEstimate(gamereq *pb.GameRequest) int32
TotalTimeEstimate estimates the amount of time this game will take, per side.
func ValidateGameRequest ¶
func ValidateGameRequest(ctx context.Context, req *pb.GameRequest) error
ValidateGameRequest validates a generic game request.
Types ¶
type AuthMethod ¶
type AuthMethod string
type CompetitionType ¶
type CompetitionType string
type DivisionManager ¶
type DivisionManager interface { SubmitResult(int, string, string, int, int, pb.TournamentGameResult, pb.TournamentGameResult, pb.GameEndReason, bool, int, string) (*pb.DivisionPairingsResponse, error) PairRound(int, bool) (*pb.DivisionPairingsResponse, error) DeletePairings(int) error GetStandings(int) (*pb.RoundStandings, int, error) GetCurrentRound() int GetPlayers() *pb.TournamentPersons SetPairing(string, string, int, pb.TournamentGameResult) (*pb.DivisionPairingsResponse, error) SetSingleRoundControls(int, *pb.RoundControl) (*pb.RoundControl, error) SetRoundControls([]*pb.RoundControl) (*pb.DivisionPairingsResponse, []*pb.RoundControl, error) SetDivisionControls(*pb.DivisionControls) (*pb.DivisionControls, map[int32]*pb.RoundStandings, error) GetDivisionControls() *pb.DivisionControls AddPlayers(*pb.TournamentPersons) (*pb.DivisionPairingsResponse, error) RemovePlayers(*pb.TournamentPersons) (*pb.DivisionPairingsResponse, error) IsRoundReady(int) error IsRoundComplete(int) (bool, error) IsStarted() bool IsFinished() (bool, error) StartRound(bool) error IsRoundStartable() error GetXHRResponse() (*pb.TournamentDivisionDataResponse, error) SetReadyForGame(userID, connID string, round, gameIndex int, unready bool) ([]string, bool, error) ClearReadyStates(userID string, round, gameIndex int) ([]*pb.Pairing, error) ResetToBeginning() error ChangeName(string) }
type EventAudienceType ¶
type EventAudienceType string
type EventWrapper ¶
type EventWrapper struct { Type pb.MessageType // The actual event should therefore be a proto object Event proto.Message // contains filtered or unexported fields }
An EventWrapper is a real-time update, whether it is a played move, a challenged move, or the game ending, a seek beginning, etc.
func EventFromByteArray ¶
func EventFromByteArray(arr []byte) (*EventWrapper, error)
EventFromByteArray takes in a serialized event and deserializes it. The event must have been serialized with an extra header.
func WrapEvent ¶
func WrapEvent(event proto.Message, messageType pb.MessageType) *EventWrapper
WrapEvent wraps a protobuf event.
func (*EventWrapper) AddAudience ¶
func (e *EventWrapper) AddAudience(audType EventAudienceType, suffix string)
AddAudience sets the audience(s) for this event. It is in the form of a NATS channel name. This is not required to be set in order to deliver a message, but certain functions will use it in the gameplay/entity module.
func (*EventWrapper) AddExcludedUsers ¶
func (e *EventWrapper) AddExcludedUsers(ids []string)
AddExcludedUsers excludes the given users from receiving this message
func (*EventWrapper) Audience ¶
func (e *EventWrapper) Audience() []string
Audience gets the audience(s) for this event, in the form of NATS channel names.
func (*EventWrapper) Serialize ¶
func (e *EventWrapper) Serialize() ([]byte, error)
Serialize serializes the event to a byte array. Our encoding inserts a two byte big-endian number indicating the length of the coming bytes, then a byte representing the message type to the start of the event.
func (*EventWrapper) SetAudience ¶
func (e *EventWrapper) SetAudience(a string)
SetAudience sets a single audience in string format.
func (*EventWrapper) SetSerializationProtocol ¶
func (e *EventWrapper) SetSerializationProtocol(protocol SerializationProtocol)
SetSerializationProtocol sets the serialization protocol of the protobuf object.
type FakeNower ¶
type FakeNower struct {
// contains filtered or unexported fields
}
FakeNower uses a fake timer. It is used for tests so we don't actually sleep.
func NewFakeNower ¶
type Game ¶
type Game struct { sync.RWMutex game.Game DBID uint Type pb.GameType PlayerDBIDs [2]uint // needed to associate the games to the player IDs in the db. GameReq *pb.GameRequest // started is set when the game actually starts (when the game timers start). // Note that the internal game.Game may have started a few seconds before, // but there should be no information about it given until _this_ started // is true. Started bool Timers Timers GameEndReason pb.GameEndReason // if 0 or 1, that player won // if -1, it was a tie! WinnerIdx int LoserIdx int Stats *Stats ChangeHook chan<- *EventWrapper Quickdata *Quickdata TournamentData *TournamentData MetaEvents *MetaEventData CreatedAt time.Time // contains filtered or unexported fields }
A Game should be saved to the database or store. It wraps a macondo.Game, and we should save most of the included fields here, especially the macondo.game.History (which can be exported as GCG, etc in the future)
func NewGame ¶
func NewGame(mcg *game.Game, req *pb.GameRequest) *Game
NewGame takes in a Macondo game that was just "started". Note that Macondo games when they start do not log any time, they just deal tiles. The time of start must be logged later, when both players are in the table and ready.
func (*Game) CachedTimeRemaining ¶
func (*Game) ChallengeRule ¶
func (g *Game) ChallengeRule() macondopb.ChallengeRule
func (*Game) CreationRequest ¶
func (g *Game) CreationRequest() *pb.GameRequest
func (*Game) GetWinnerIdx ¶
func (*Game) HistoryRefresherEvent ¶
func (g *Game) HistoryRefresherEvent() *pb.GameHistoryRefresher
func (*Game) NewActiveGameEntry ¶
func (g *Game) NewActiveGameEntry(gameStillActive bool) *EventWrapper
func (*Game) RatingKey ¶
func (g *Game) RatingKey() (VariantKey, error)
func (*Game) RatingMode ¶
func (g *Game) RatingMode() pb.RatingMode
func (*Game) RecordTimeOfMove ¶
func (*Game) RegisterChangeHook ¶
func (g *Game) RegisterChangeHook(eventChan chan<- *EventWrapper) error
RegisterChangeHook registers a channel with the game. Events will be sent down this channel.
func (*Game) ResetTimersAndStart ¶
func (g *Game) ResetTimersAndStart()
Reset timers to _now_. The game is actually starting.
func (*Game) SendChange ¶
func (g *Game) SendChange(e *EventWrapper)
SendChange sends an event via the registered hook.
func (*Game) SetGameEndReason ¶
func (g *Game) SetGameEndReason(r pb.GameEndReason)
func (*Game) SetLoserIdx ¶
func (*Game) SetTimerModule ¶
SetTimerModule sets the timer for a game to the given Nower.
func (*Game) SetWinnerIdx ¶
func (*Game) TimeRanOut ¶
TimeRanOut calculates if time ran out for the given player. Assumes player is on turn, otherwise it always returns false.
func (*Game) TimeRemaining ¶
TimeRemaining calculates the time remaining, but does NOT update it.
func (*Game) TimeStarted ¶
func (*Game) TimerModule ¶
TimerModule gets the Nower for this game.
func (*Game) WinnerWasSet ¶
type GameHistory ¶
type GameHistory struct {
macondopb.GameHistory
}
func (*GameHistory) Scan ¶
func (h *GameHistory) Scan(value interface{}) error
type GameRequest ¶
type GameRequest struct {
pb.GameRequest
}
func (*GameRequest) Scan ¶
func (g *GameRequest) Scan(value interface{}) error
type GameTimer ¶
type GameTimer struct{}
GameTimer uses the standard library's `time` package to determine how much time has elapsed in a game.
type IncrementType ¶
type IncrementType int
const ( EventType IncrementType = iota GameType FinalType )
type ListDatum ¶
type ListDatum struct { // Used for words Word string `json:"w,omitempty"` Probability int `json:"p,omitempty"` // Used for words or games: Score int `json:"s,omitempty"` // Used for comments: Comment string `json:"c,omitempty"` // Used for mistakes: MistakeType int `json:"t,omitempty"` MistakeSize int `json:"z,omitempty"` // Used for ratings: Rating int `json:"r,omitempty"` Variant string `json:"v,omitempty"` }
A ListDatum is the individual datum that is stored in a list. It is a sort of "union" of various struct types. Depending on the type of stat, only some of thees fields will be filled in.
type MetaEventData ¶
type MetaEventData struct {
Events []*pb.GameMetaEvent `json:"events"`
}
MetaEventData holds a list of meta events, such as requesting aborts, adjourns, etc.
type MistakeMagnitude ¶
type MistakeMagnitude string
type MistakeType ¶
type MistakeType string
type Nower ¶
type Nower interface { // Now returns a timestamp in milliseconds Now() int64 }
Nower is an interface for determining the current time
type PoolMember ¶
type Profile ¶
type Profile struct { FirstName string LastName string // BirthDate uses ISO format YYYY-MM-DD BirthDate string CountryCode string Title string About string Ratings Ratings Stats ProfileStats AvatarUrl string }
Profile is a user profile. It might not be defined for anonymous users.
type ProfileStats ¶
type ProfileStats struct {
Data map[VariantKey]*Stats
}
type Quickdata ¶
type Quickdata struct { OriginalRequestId string `json:"o"` FinalScores []int32 `json:"s"` PlayerInfo []*pb.PlayerInfo `json:"pi"` OriginalRatings []float64 NewRatings []float64 }
Quickdata represents data that we might need quick access to, for the purposes of aggregating large numbers of games rapidly. This should get saved in its own blob in the store, as opposed to being buried within a game history.
type Ratings ¶
type Ratings struct {
Data map[VariantKey]SingleRating
}
Ratings gets stored into a PostgreSQL database.
type SerializationProtocol ¶
type SerializationProtocol int
const ( EvtSerializationProtoWithHeader SerializationProtocol = iota EvtSerializationProto EvtSerializationJSONWithHeader EvtSerializationJSON )
type SingleRating ¶
type SingleRating struct { Rating float64 `json:"r"` RatingDeviation float64 `json:"rd"` Volatility float64 `json:"v"` // This is the last game timestamp for this user for THIS variant: LastGameTimestamp int64 `json:"ts"` }
SingleRating encodes a whole Glicko-225 rating object.
func NewDefaultRating ¶
func NewDefaultRating(lastGameIsNow bool) *SingleRating
func (*SingleRating) Scan ¶
func (r *SingleRating) Scan(value interface{}) error
type SoughtGame ¶
type SoughtGame struct {
SeekRequest *pb.SeekRequest
}
func NewSoughtGame ¶
func NewSoughtGame(seekRequest *pb.SeekRequest) *SoughtGame
func (*SoughtGame) ID ¶
func (sg *SoughtGame) ID() (string, error)
func (*SoughtGame) ReceiverConnID ¶
func (sg *SoughtGame) ReceiverConnID() (string, error)
func (*SoughtGame) ReceiverDisplayName ¶
func (sg *SoughtGame) ReceiverDisplayName() (string, error)
func (*SoughtGame) ReceiverIsPermanent ¶
func (sg *SoughtGame) ReceiverIsPermanent() (bool, error)
func (*SoughtGame) ReceiverUserID ¶
func (sg *SoughtGame) ReceiverUserID() (string, error)
func (*SoughtGame) Scan ¶
func (sg *SoughtGame) Scan(value interface{}) error
func (*SoughtGame) SeekerConnID ¶
func (sg *SoughtGame) SeekerConnID() (string, error)
func (*SoughtGame) SeekerUserID ¶
func (sg *SoughtGame) SeekerUserID() (string, error)
type StatItemType ¶
type StatItemType int
const ( SingleType StatItemType = iota ListType MinimumType MaximumType )
type TimeControl ¶
type TimeControl string
func VariantFromGameReq ¶
func VariantFromGameReq(gamereq *pb.GameRequest) (TimeControl, game.Variant, error)
type Timers ¶
type Timers struct { // TimeOfLastUpdate is the timestamp of the last update, in milliseconds. // If no update has been made, this defaults to timeStarted. TimeOfLastUpdate int64 `json:"lu"` // TimeStarted is a unix timestamp, in milliseconds. TimeStarted int64 `json:"ts"` // TimeRemaining is an array of remaining time per player, in milliseconds. TimeRemaining []int `json:"tr"` // MaxOvertime is in minutes. All others are in milliseconds. MaxOvertime int `json:"mo"` }
type Tournament ¶
type Tournament struct { sync.RWMutex UUID string `json:"uuid"` Name string `json:"name"` Description string `json:"desc"` // XXX: We will likely remove the following two fields AliasOf string `json:"aliasOf"` URL string `json:"url"` // XXX: Investigate above. ExecutiveDirector string `json:"execDirector"` Directors *pb.TournamentPersons `json:"directors"` IsStarted bool `json:"started"` IsFinished bool `json:"finished"` Divisions map[string]*TournamentDivision `json:"divs"` Type CompetitionType `json:"type"` ParentID string `json:"parent"` Slug string `json:"slug"` ExtraMeta *TournamentMeta `json:"extraMeta"` }
type TournamentData ¶
type TournamentData struct { Id string Division string `json:"d"` Round int `json:"r"` GameIndex int `json:"i"` }
TournamentData holds the tournament data for a game. This is nil if the game is not a tournament game.
type TournamentDivision ¶
type TournamentDivision struct { ManagerType TournamentType `json:"mgrType"` DivisionRawMessage json.RawMessage `json:"json"` DivisionManager DivisionManager `json:"-"` }
type TournamentMeta ¶
type TournamentMeta struct { Disclaimer string `json:"disclaimer"` TileStyle string `json:"tileStyle"` BoardStyle string `json:"boardStyle"` DefaultClubSettings *pb.GameRequest `json:"defaultClubSettings"` FreeformClubSettingFields []string `json:"freeformClubSettingFields"` Password string `json:"password"` Logo string `json:"logo"` Color string `json:"color"` PrivateAnalysis bool `json:"privateAnalysis"` IRLMode bool `json:"irlMode"` }
type TournamentType ¶
type TournamentType int
const ( ClassicTournamentType TournamentType = iota // It's gonna be lit: ArenaTournamentType )
type UnpairedPoolMembers ¶
type UnpairedPoolMembers struct { PoolMembers []*PoolMember RoundControls *ipc.RoundControl Repeats map[string]int }
type User ¶
type User struct { sync.RWMutex Anonymous bool // ID is the database ID. Since this increases monotonically, we should // not expose it to the user ID uint // UUID is the "user-exposed" ID, in any APIs. UUID string Username string Password string Email string Profile *Profile // CurrentChannel tracks presence; where is the user currently? CurrentChannel string IsBot bool IsDirector bool IsMod bool IsAdmin bool // DEPRECATED: use db actions Actions *Actions Notoriety int AuthedMethod AuthMethod }
User - the db-specific details are in the store package.
func (*User) GetProtoRatings ¶
func (u *User) GetProtoRatings() (map[string]*pb.ProfileUpdate_Rating, error)
func (*User) GetRating ¶
func (u *User) GetRating(ratingKey VariantKey) (*SingleRating, error)
GetRating gets a full Glicko-225 rating for this user, based on the passed-in rating key.
func (*User) GetRelevantRating ¶
func (u *User) GetRelevantRating(ratingKey VariantKey) string
GetRelevantRating gets a displayable rating for this user, based on the passed-in rating key (encoding variant, time control, etc)
func (*User) IsChild ¶
func (u *User) IsChild() pb.ChildStatus
func (*User) RealNameIfNotYouth ¶
RealNameIfNotYouth returns a user's real name, only if they are older than 13. If a birth date has not been provided, do not show it.
func (*User) TournamentID ¶
TournamentID returns the "player ID" of a user. UUID:username is probably not a good design, but let's at least narrow it down to this function.
type UserPermission ¶
type UserPermission int
const ( PermDirector UserPermission = iota PermMod PermAdmin PermBot )
type VariantKey ¶
type VariantKey string
func LexiconToPuzzleVariantKey ¶
func LexiconToPuzzleVariantKey(lexicon string) VariantKey
func ToVariantKey ¶
func ToVariantKey(lexiconName string, variantName game.Variant, timeControl TimeControl) VariantKey
type WooglesError ¶
type WooglesError struct {
// contains filtered or unexported fields
}
func NewWooglesError ¶
func NewWooglesError(code ipc.WooglesError, data ...string) *WooglesError
func (*WooglesError) Error ¶
func (w *WooglesError) Error() string