hangman

package
v0.0.0-...-63692ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHandler

func MakeHandler(s Service, l kitlog.Logger) http.Handler

MakeHandler to serve game routes

Types

type NewGameRequest

type NewGameRequest struct {
	Cookies []*http.Cookie `json:"cookies"`
}

NewGameRequest for a new game

type Response

type Response struct {
	Game  game.Game `json:"game"`
	Tally Tally     `json:"tally"`
}

Response returns a new game and tally

type Service

type Service interface {
	NewGame([]*http.Cookie) (game.Game, Tally, error)
	Guess(game.Game, string) (game.Game, Tally, error)
}

Service represent a hangman game interaction

func NewLoggingService

func NewLoggingService(s Service, l log.Logger) Service

NewLoggingService returns a new instance to the logging service

func NewService

func NewService(dicURL, gameURL string) Service

NewService creates a game service

type Tally

type Tally struct {
	Status    game.Status `json:"status"`
	TurnsLeft int         `json:"turns_left"`
	Letters   string      `json:"letters"`
}

Tally tracks the user score

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL