poker

package
v0.0.0-...-cdffa6e Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const BadPlayerInputErrMsg = "Bad value received for number of players, please try again with a number"
View Source
const BadWinnerInputErrMsg = "invalid winner input, expect format of 'PlayerName wins'"
View Source
const PlayerPrompt = "Please enter the number of players: "

Variables

This section is empty.

Functions

func StdOutAlerter

func StdOutAlerter(duration time.Duration, amount int)

Types

type BlindAlerter

type BlindAlerter interface {
	ScheduleAlertAt(duration time.Duration, amount int)
}

type BlindAlerterFunc

type BlindAlerterFunc func(duration time.Duration, amount int)

func (BlindAlerterFunc) ScheduleAlertAt

func (a BlindAlerterFunc) ScheduleAlertAt(duration time.Duration, amount int)

type CLI

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

func NewCLI

func NewCLI(in io.Reader, out io.Writer, game Game) *CLI

func (*CLI) PlayPoker

func (cli *CLI) PlayPoker()

type FileSystemStore

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

func FileSystemPlayerStoreFromFile

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

func NewFileSystemStore

func NewFileSystemStore(database *os.File) (*FileSystemStore, error)

func (*FileSystemStore) GetLeague

func (f *FileSystemStore) GetLeague() League

func (*FileSystemStore) GetPlayerScore

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

func (*FileSystemStore) RecordWin

func (f *FileSystemStore) RecordWin(name string)

type Game

type Game interface {
	Start(numberOfPlayers int)
	Finish(winner string)
}

type InMemoryPlayerStore

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

func NewInMemoryPlayerStore

func NewInMemoryPlayerStore() *InMemoryPlayerStore

func (*InMemoryPlayerStore) GetLeague

func (i *InMemoryPlayerStore) GetLeague() League

func (*InMemoryPlayerStore) GetPlayerScore

func (i *InMemoryPlayerStore) GetPlayerScore(name string) int

func (*InMemoryPlayerStore) RecordWin

func (i *InMemoryPlayerStore) RecordWin(name string)

type League

type League []Player

func (League) Find

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

type Player

type Player struct {
	Name string
	Wins int
}

func NewLeague

func NewLeague(rdr io.Reader) ([]Player, error)

type PlayerServer

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

func NewPlayerServer

func NewPlayerServer(store PlayerStore) *PlayerServer

func (*PlayerServer) GetPlayerScore

func (p *PlayerServer) GetPlayerScore(name string) int

type PlayerStore

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

type TexasHoldem

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

func NewTexasHoldem

func NewTexasHoldem(alerter BlindAlerter, store PlayerStore) *TexasHoldem

func (*TexasHoldem) Finish

func (p *TexasHoldem) Finish(winner string)

func (*TexasHoldem) Start

func (p *TexasHoldem) Start(numberOfPlayers int)

Directories

Path Synopsis
cmd
cli

Jump to

Keyboard shortcuts

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