poker

package
v0.0.0-...-d0adc60 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertPlayerWin

func AssertPlayerWin(t *testing.T, store *StubPlayerStore, winner string)

Types

type CLI

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

func NewCLI

func NewCLI(store PlayerStore, in io.Reader) *CLI

func (*CLI) PlayPoker

func (cli *CLI) PlayPoker()

type FileSystemPlayerStore

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

func FileSystemPlayerStoreFromFile

func FileSystemPlayerStoreFromFile(path string) (*FileSystemPlayerStore, func(), error)

func NewFileSystemPlayerStore

func NewFileSystemPlayerStore(file *os.File) (*FileSystemPlayerStore, error)

func (*FileSystemPlayerStore) GetLeague

func (f *FileSystemPlayerStore) GetLeague() League

func (*FileSystemPlayerStore) GetLeagueSort

func (f *FileSystemPlayerStore) GetLeagueSort() League

func (*FileSystemPlayerStore) GetPlayerScore

func (f *FileSystemPlayerStore) GetPlayerScore(name string) int

func (*FileSystemPlayerStore) RecordWin

func (f *FileSystemPlayerStore) RecordWin(name string)

type League

type League []Player

func NewLeague

func NewLeague(rdr io.Reader) (League, error)

func (League) Find

func (l League) Find(name string) *Player

type Player

type Player struct {
	Name string
	Wins int
}

type PlayerServer

type PlayerServer struct {
	http.Handler
	// contains filtered or unexported fields
}

func NewPlayerServer

func NewPlayerServer(store PlayerStore) *PlayerServer

type PlayerStore

type PlayerStore interface {
	GetPlayerScore(name string) int
	RecordWin(name string)
	GetLeague() League
}

type StubPlayerStore

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

func (*StubPlayerStore) GetLeague

func (s *StubPlayerStore) GetLeague() League

func (*StubPlayerStore) GetPlayerScore

func (s *StubPlayerStore) GetPlayerScore(name string) int

func (*StubPlayerStore) RecordWin

func (s *StubPlayerStore) RecordWin(name string)

Directories

Path Synopsis
cmd
cli

Jump to

Keyboard shortcuts

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