Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Won indicates the game ended with a win Won = iota // Lost indicates the game ended with a loss Lost // Good indicates a correct guess Good // Bad indicates a bad guess Bad // Guessed indicates a letter was already guessed Guessed // Started indicates the game begun Started )
Variables ¶
This section is empty.
Functions ¶
func DecodeGuessRequest ¶
DecodeGuessRequest extracts guess and game state from requests
Types ¶
type Game ¶
type Game struct { Letters string `json:"letters"` Status Status `json:"status"` TurnsLeft int `json:"turnsLeft"` Guesses []rune `json:"guesses"` }
Game records state for hangman
func (*Game) AlreadyGuessed ¶
AlreadyGuessed checks if the given letter has been guessed
type GuessRequest ¶
GuessRequest proposes a new guess
type NewGameRequest ¶
NewGameRequest requests a new game given a word
type Response ¶
type Response struct {
Game Game `json:"game"`
}
Response replies with the current game
type Service ¶
Service represents the game service
func NewLoggingService ¶
NewLoggingService returns a new instance to the logging service
Click to show internal directories.
Click to hide internal directories.