game

package
v0.0.0-...-802e8cc Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintWinCount

func PrintWinCount(games []Game)

Types

type AutoGame

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

func NewAutoGame

func NewAutoGame(verifierCards []*verifiers.VerifierCard, actualVerifiers []*verifiers.Verifier, actualCode []int) *AutoGame

func (*AutoGame) AskQuestion

func (g *AutoGame) AskQuestion(player Player, code []int, verifier int) bool

func (*AutoGame) GetVerifierCards

func (g *AutoGame) GetVerifierCards() []*verifiers.VerifierCard

func (*AutoGame) MakeGuess

func (g *AutoGame) MakeGuess(player Player, code []int) (correct bool)

func (*AutoGame) Rank

func (g *AutoGame) Rank() [][]Player

func (*AutoGame) String

func (g *AutoGame) String() string

type Game

type Game interface {
	fmt.Stringer
	GetVerifierCards() []*verifiers.VerifierCard
	AskQuestion(player Player, code []int, verifier int) bool
	MakeGuess(player Player, code []int) bool
	// Rank returns the players in order of their performance. Ties go into the same slice
	Rank() [][]Player
}

func JoinGames

func JoinGames(addr string, playerName string) ([]Game, error)

func NewInteractiveGame

func NewInteractiveGame(cards []*verifiers.VerifierCard) Game

type InteractiveGame

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

func (*InteractiveGame) AskQuestion

func (g *InteractiveGame) AskQuestion(player Player, code []int, verifierIndex int) bool

func (*InteractiveGame) GetVerifierCards

func (g *InteractiveGame) GetVerifierCards() []*verifiers.VerifierCard

func (*InteractiveGame) MakeGuess

func (g *InteractiveGame) MakeGuess(player Player, code []int) bool

func (*InteractiveGame) Rank

func (g *InteractiveGame) Rank() [][]Player

func (*InteractiveGame) Stats

func (g *InteractiveGame) Stats() map[Player]*PlayerMoves

func (*InteractiveGame) String

func (g *InteractiveGame) String() string

type Player

type Player interface {
	// GetPlayerName returns the name of the player
	GetPlayerName() string
}

type PlayerMoves

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

type Question

type Question struct {
	Code []int
	Card *verifiers.VerifierCard
}

type RemoteGame

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

func (*RemoteGame) AskQuestion

func (g *RemoteGame) AskQuestion(player Player, code []int, verifier int) bool

func (*RemoteGame) GetVerifierCards

func (g *RemoteGame) GetVerifierCards() []*verifiers.VerifierCard

func (*RemoteGame) MakeGuess

func (g *RemoteGame) MakeGuess(player Player, code []int) bool

func (*RemoteGame) Rank

func (g *RemoteGame) Rank() [][]Player

func (*RemoteGame) Stats

func (g *RemoteGame) Stats() map[Player]*PlayerMoves

func (*RemoteGame) String

func (g *RemoteGame) String() string

type Solution

type Solution struct {
	Code      []int
	Verifiers []*verifiers.Verifier
}

func (Solution) String

func (sol Solution) String() string

Jump to

Keyboard shortcuts

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