Documentation ¶
Index ¶
- func CheckTimers(ctx context.Context, state *State, game *Game) error
- func ClueAnswered(state *State, game *Game, board *BoardLayout, clueNumber int, ...) bool
- func FillInGridAnswerAcross(startRow, startCol, numRows, numCols int, answer string, grid []string) []string
- func FillInGridAnswerDown(startRow, startCol, numRows, numCols int, answer string, grid []string) []string
- func GameID() string
- func GetGame(state *State) http.HandlerFunc
- func GetLayouts(state *State) http.HandlerFunc
- func IncrementClue(ctx context.Context, state *State, game *Game) error
- func InitializeGrid(numRows, numCols int, grid []string, gridNums []int) []string
- func NewRouter() http.Handler
- func PlayerClueIDRound(name string, number int, direction string, round int) string
- func PostGame(state *State) http.HandlerFunc
- func PostGuess(state *State) http.HandlerFunc
- func PostLayout(state *State) http.HandlerFunc
- func PostPlayer(state *State) http.HandlerFunc
- func WaitingOnPlayers(currentPlayers []Player, guesses []Guess, currentRound int) []string
- type BoardLayout
- func (b *BoardLayout) CalculateScore(guess string, number int, direction string) (int, bool)
- func (b BoardLayout) ClueLabel(number int, direction string) int
- func (b BoardLayout) ClueLabelPosition(clueLabel int) (int, int)
- func (b *BoardLayout) CorrectAnswer(clueNumber int, clueDirection string) string
- func (b BoardLayout) GetClue(number int, direction string, expiresAt *time.Time) Clue
- func (b BoardLayout) GetLastClue(number int, direction string) Clue
- func (b *BoardLayout) MaskAnswer(answer string, currentClueNumber int, currentClueDirection string, ...) string
- func (b BoardLayout) Next(number int, direction string) (int, string)
- func (b BoardLayout) Prev(number int, direction string) (int, string)
- type Clue
- type Game
- type GameState
- type Guess
- type GuessState
- type Player
- type PlayerState
- type State
- func (state *State) CreateBoardLayout(w BoardLayout) error
- func (state *State) CreateGame(ctx context.Context, boardID string) (string, error)
- func (state *State) CreateGuess(ctx context.Context, gameID, name string, clueNumber int, ...) error
- func (state *State) CreatePlayer(ctx context.Context, gameID, name string) error
- func (state *State) GetBoardLayout(ctx context.Context, id string) (*BoardLayout, error)
- func (state *State) GetBoardLayouts(ctx context.Context) ([]BoardLayout, error)
- func (state *State) GetGame(ctx context.Context, gameID string) (*GameState, error)
- func (state *State) GetGuesses(ctx context.Context, gameID string) ([]GuessState, error)
- func (state *State) GetPlayers(ctx context.Context, gameID string) ([]PlayerState, error)
- func (state *State) UpdateGameClue(ctx context.Context, id string, number int, direction string, lastNumber int, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClueAnswered ¶
func FillInGridAnswerAcross ¶
func FillInGridAnswerDown ¶
func InitializeGrid ¶
func PlayerClueIDRound ¶
func PostPlayer ¶
func PostPlayer(state *State) http.HandlerFunc
PostPlayer creates new player in game
Types ¶
type BoardLayout ¶
type BoardLayout struct { Admin bool `json:"admin"` Answers *struct { Across []string `json:"across"` Down []string `json:"down"` } `json:"answers"` Author string `json:"author"` Autowrap interface{} `json:"autowrap"` Bbars interface{} `json:"bbars"` Circles interface{} `json:"circles"` Clues struct { Across []string `json:"across"` Down []string `json:"down"` } `json:"clues"` Code interface{} `json:"code"` Copyright string `json:"copyright"` Date string `json:"date"` Dow string `json:"dow"` Downmap interface{} `json:"downmap"` Editor string `json:"editor"` Grid []string `json:"grid"` Gridnums []int `json:"gridnums"` Hastitle bool `json:"hastitle"` Hold interface{} `json:"hold"` ID string `json:"id" dynamo:"ID,hash"` ID2 interface{} `json:"id2"` Interpretcolors interface{} `json:"interpretcolors"` Jnotes interface{} `json:"jnotes"` Key interface{} `json:"key"` Mini interface{} `json:"mini"` Notepad interface{} `json:"notepad"` Publisher string `json:"publisher"` Rbars interface{} `json:"rbars"` Shadecircles interface{} `json:"shadecircles"` Size struct { Cols int `json:"cols"` Rows int `json:"rows"` } `json:"size"` Title string `json:"title"` Track interface{} `json:"track"` Type interface{} `json:"type"` Uniclue bool `json:"uniclue"` Valid bool `json:"valid"` }
func (*BoardLayout) CalculateScore ¶
func (BoardLayout) ClueLabelPosition ¶
func (b BoardLayout) ClueLabelPosition(clueLabel int) (int, int)
func (*BoardLayout) CorrectAnswer ¶
func (b *BoardLayout) CorrectAnswer(clueNumber int, clueDirection string) string
func (BoardLayout) GetLastClue ¶
func (b BoardLayout) GetLastClue(number int, direction string) Clue
func (*BoardLayout) MaskAnswer ¶
type Clue ¶
type Clue struct { Number int `json:"number"` Direction string `json:"direction"` Description string `json:"description"` Answer string `json:"answer,omitempty"` // ?A? Guesses []Guess `json:"guesses,omitempty"` WaitingOnPlayers []string `json:"waiting_on_players,omitempty"` ExpiresAt *time.Time `json:"expires_at,omitempty"` }
type Game ¶
type Guess ¶
type Guess struct { Player Player `json:"player" dynamo:"-"` Clue Clue `json:"-" dynamo:"-"` Guess string `json:"guess"` Score int `json:"score"` SubmittedAt time.Time `json:"submitted_at"` IsCorrect bool `json:"-"` LatestRound int `json:"-"` }
func AddOrSetGuess ¶
func AddOrSetGuess(board *BoardLayout, g Guess, guesses []Guess) []Guess
type GuessState ¶
type GuessState struct { GameID string `dynamo:"GameID,hash"` PlayerClueID string `dynamo:",range"` CreatedAt time.Time UpdatedAt time.Time Guess string }
func (GuessState) ClueDirection ¶
func (g GuessState) ClueDirection() string
func (GuessState) ClueNumber ¶
func (g GuessState) ClueNumber() int
func (GuessState) PlayerName ¶
func (g GuessState) PlayerName() string
func (GuessState) Round ¶
func (g GuessState) Round() int
type PlayerState ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) CreateBoardLayout ¶
func (state *State) CreateBoardLayout(w BoardLayout) error
func (*State) CreateGame ¶
func (*State) CreateGuess ¶
func (*State) CreatePlayer ¶
func (*State) GetBoardLayout ¶
func (*State) GetBoardLayouts ¶
func (state *State) GetBoardLayouts(ctx context.Context) ([]BoardLayout, error)
func (*State) GetGuesses ¶
func (*State) GetPlayers ¶
Click to show internal directories.
Click to hide internal directories.