contest

package
v0.0.0-...-e49772e Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

type Notifier interface {
	NotifyPlayerJoined(string, string)
	NotifyPlayerLeft(string, string)
	NotifyRoomUpdated(RoomOptions, string)
	NotifyGameStarted(playerKey string)
	NotifyPlayerAnswered(string, int)
	NotifyQuestionCountdown(int, int)
	NotifyQuestion(string, int)
	NotifyAnswerTimeCountdown(int)
	NotifyQuestionResults(result QuestionResult)
	NotifyGameEnded(reason string, result map[string]int)
	NotifyPlayerKicked(string, string, string)
}

type Player

type Player struct {
	Notifier
	Secret string
	Key    string
	Name   string
	// contains filtered or unexported fields
}

type Question

type Question struct {
	Street geodata.Street
	// contains filtered or unexported fields
}

type QuestionResult

type QuestionResult struct {
	Question       string           `json:"question"`
	Solution       types.Coordinate `json:"solution"`
	PointDelta     map[string]int   `json:"pointDelta"`
	Points         map[string]int   `json:"points"`
	QuestionNumber int              `json:"questionNumber"`
}

type Room

type Room struct {
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom(seedText string) *Room

func (*Room) AdvanceToNextQuestion

func (r *Room) AdvanceToNextQuestion()

func (*Room) AnswerQuestion

func (r *Room) AnswerQuestion(playerKey string, guess types.Coordinate) (int, error)

func (*Room) CanBeAdvanced

func (r *Room) CanBeAdvanced() bool

func (*Room) Close

func (r *Room) Close() error

func (*Room) ConfigErrors

func (r *Room) ConfigErrors() []string

func (*Room) Creation

func (r *Room) Creation() time.Time

func (*Room) FindPlayer

func (r *Room) FindPlayer(key string) (*Player, bool)

func (*Room) Finished

func (r *Room) Finished() bool

func (*Room) HasActiveQuestion

func (r *Room) HasActiveQuestion(playerKey string) bool

func (*Room) Join

func (r *Room) Join(name string) Player

func (*Room) Key

func (r *Room) Key() string

func (*Room) Kick

func (r *Room) Kick(target string, initiator string) Player

func (*Room) Leave

func (r *Room) Leave(playerKey string) Player

func (*Room) Lock

func (r *Room) Lock()

func (*Room) Options

func (r *Room) Options() RoomOptions

func (*Room) Play

func (r *Room) Play(playerKey string)

func (*Room) Players

func (r *Room) Players() []Player

func (*Room) Question

func (r *Room) Question() (string, int)

func (*Room) SetOptions

func (r *Room) SetOptions(options RoomOptions, playerKey string)

func (*Room) Started

func (r *Room) Started() bool

func (*Room) Unlock

func (r *Room) Unlock()

type RoomOptions

type RoomOptions struct {
	StreetList        *geodata.StreetList
	NumberOfQuestions int
	MaxAnswerTime     time.Duration
}

func (*RoomOptions) Errors

func (r *RoomOptions) Errors() []string

Jump to

Keyboard shortcuts

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