Documentation ¶
Index ¶
- func NewGuid() string
- func RandomSuit(deck Deck) string
- func Run(configPath string)
- func RunTest()
- func SetupHTTPServer(uiDirectory string, responder Responder)
- type Action
- type Card
- type CardBag
- type Client
- type Config
- type CurrentHand
- type Deck
- type DeckType
- type DoubleDeck
- func (dd *DoubleDeck) Compare(l *Card, r *Card) int
- func (dd *DoubleDeck) CompareNumbers(l string, r string) int
- func (dd *DoubleDeck) CompareSuits(l string, r string) int
- func (dd *DoubleDeck) DeckType() DeckType
- func (dd *DoubleDeck) Numbers() []string
- func (dd *DoubleDeck) Shuffle() shuffler
- func (dd *DoubleDeck) Size() int
- func (dd *DoubleDeck) Suits() []string
- type FinishRoundAction
- type Game
- type GameConcurrencyWrapper
- func (gcw *GameConcurrencyWrapper) FinishRound() error
- func (gcw *GameConcurrencyWrapper) GetModel() string
- func (gcw *GameConcurrencyWrapper) GetPlayerModel(player string) *PlayerModel
- func (gcw *GameConcurrencyWrapper) Join(player string) (string, error)
- func (gcw *GameConcurrencyWrapper) MakeWager(player string, hands int) error
- func (gcw *GameConcurrencyWrapper) PlayCard(player string, card *Card) error
- func (gcw *GameConcurrencyWrapper) RemovePlayer(player string) error
- func (gcw *GameConcurrencyWrapper) SetCardsPerPlayer(count int) error
- func (gcw *GameConcurrencyWrapper) SetDeck() error
- func (gcw *GameConcurrencyWrapper) SetDeckType(deckType DeckType) error
- func (gcw *GameConcurrencyWrapper) StartRound() error
- type GameState
- type GetPlayerModelAction
- type Hand
- type JoinAction
- type MakeWagerAction
- type PlayerAction
- type PlayerCard
- type PlayerGame
- type PlayerModel
- type PlayerMood
- type PlayerState
- type PlayerStatus
- type PreviousHand
- type RemovePlayerAction
- type Responder
- type Round
- type RoundState
- type SetCardsPerPlayerAction
- type SetDeckTypePlayerAction
- type SimpleDeck
- func NewDeterministicShuffleDeck() *SimpleDeck
- func NewMiniDeckWithShuffle(shuffle shuffler) *SimpleDeck
- func NewSimpleDeck(numbers []string, suits []string, deckType DeckType, shuffle shuffler) *SimpleDeck
- func NewStandardDeck() *SimpleDeck
- func NewStandardDeckWithShuffle(shuffle shuffler) *SimpleDeck
- func (sd *SimpleDeck) Compare(l *Card, r *Card) int
- func (sd *SimpleDeck) CompareNumbers(l string, r string) int
- func (sd *SimpleDeck) CompareSuits(l string, r string) int
- func (sd *SimpleDeck) DeckType() DeckType
- func (sd *SimpleDeck) Numbers() []string
- func (sd *SimpleDeck) Shuffle() shuffler
- func (sd *SimpleDeck) Size() int
- func (sd *SimpleDeck) Suits() []string
- type StartRoundAction
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomSuit ¶
func SetupHTTPServer ¶
Types ¶
type Card ¶
func RandomShuffle ¶ added in v0.3.0
type CardBag ¶ added in v0.3.0
type CardBag struct {
Cards map[string]*PlayerCard
}
func NewCardBag ¶ added in v0.3.0
type Client ¶
func (*Client) GetMyModel ¶
func (client *Client) GetMyModel(me string) (*PlayerModel, error)
type CurrentHand ¶
type DeckType ¶ added in v0.3.0
type DeckType string
const ( // use Custom if your deck isn't one of the predefined types DeckTypeCustom DeckType = "DeckTypeCustom" DeckTypeMini DeckType = "DeckTypeMini" DeckTypeDoubleMini DeckType = "DeckTypeDoubleMini" DeckTypeStandard DeckType = "DeckTypeStandard" DeckTypeDoubleStandard DeckType = "DeckTypeDoubleStandard" DeckTypeDeterministicStandard DeckType = "DeckTypeDeterministicStandard" )
func (DeckType) JSONString ¶ added in v0.3.0
func (DeckType) MarshalJSON ¶ added in v0.3.0
func (DeckType) MarshalText ¶ added in v0.3.0
func (*DeckType) UnmarshalJSON ¶ added in v0.3.0
func (*DeckType) UnmarshalText ¶ added in v0.3.0
type DoubleDeck ¶ added in v0.3.0
DoubleDeck can be used for larger games to increase the number of cards. It has two cards for each number/suit, and otherwise works identically to its underlying deck.
func NewDoubleDeck ¶ added in v0.3.0
func NewDoubleDeck(underlyingDeck Deck, deckType DeckType) *DoubleDeck
func NewDoubleStandardDeck ¶
func NewDoubleStandardDeck() *DoubleDeck
func (*DoubleDeck) CompareNumbers ¶ added in v0.3.0
func (dd *DoubleDeck) CompareNumbers(l string, r string) int
func (*DoubleDeck) CompareSuits ¶ added in v0.3.0
func (dd *DoubleDeck) CompareSuits(l string, r string) int
func (*DoubleDeck) DeckType ¶ added in v0.3.0
func (dd *DoubleDeck) DeckType() DeckType
func (*DoubleDeck) Numbers ¶ added in v0.3.0
func (dd *DoubleDeck) Numbers() []string
func (*DoubleDeck) Shuffle ¶ added in v0.3.0
func (dd *DoubleDeck) Shuffle() shuffler
func (*DoubleDeck) Size ¶ added in v0.3.0
func (dd *DoubleDeck) Size() int
func (*DoubleDeck) Suits ¶ added in v0.3.0
func (dd *DoubleDeck) Suits() []string
type FinishRoundAction ¶
type FinishRoundAction struct{}
type Game ¶
type GameConcurrencyWrapper ¶
func NewGameConcurrencyWrapper ¶
func NewGameConcurrencyWrapper(game *Game, stop <-chan struct{}) *GameConcurrencyWrapper
func (*GameConcurrencyWrapper) FinishRound ¶
func (gcw *GameConcurrencyWrapper) FinishRound() error
func (*GameConcurrencyWrapper) GetModel ¶
func (gcw *GameConcurrencyWrapper) GetModel() string
func (*GameConcurrencyWrapper) GetPlayerModel ¶
func (gcw *GameConcurrencyWrapper) GetPlayerModel(player string) *PlayerModel
func (*GameConcurrencyWrapper) Join ¶
func (gcw *GameConcurrencyWrapper) Join(player string) (string, error)
func (*GameConcurrencyWrapper) MakeWager ¶
func (gcw *GameConcurrencyWrapper) MakeWager(player string, hands int) error
func (*GameConcurrencyWrapper) PlayCard ¶
func (gcw *GameConcurrencyWrapper) PlayCard(player string, card *Card) error
func (*GameConcurrencyWrapper) RemovePlayer ¶
func (gcw *GameConcurrencyWrapper) RemovePlayer(player string) error
func (*GameConcurrencyWrapper) SetCardsPerPlayer ¶
func (gcw *GameConcurrencyWrapper) SetCardsPerPlayer(count int) error
func (*GameConcurrencyWrapper) SetDeck ¶
func (gcw *GameConcurrencyWrapper) SetDeck() error
func (*GameConcurrencyWrapper) SetDeckType ¶ added in v0.3.0
func (gcw *GameConcurrencyWrapper) SetDeckType(deckType DeckType) error
func (*GameConcurrencyWrapper) StartRound ¶
func (gcw *GameConcurrencyWrapper) StartRound() error
type GetPlayerModelAction ¶
type GetPlayerModelAction struct{}
type Hand ¶
type JoinAction ¶
type JoinAction struct{}
type MakeWagerAction ¶
type MakeWagerAction struct {
Hands int
}
type PlayerAction ¶
type PlayerAction struct { Me string GetModel *GetPlayerModelAction Join *JoinAction MakeWager *MakeWagerAction PlayCard *Card RemovePlayer *RemovePlayerAction SetCardsPerPlayer *SetCardsPerPlayerAction SetDeckType *SetDeckTypePlayerAction StartRound *StartRoundAction FinishRound *FinishRoundAction }
type PlayerCard ¶
type PlayerGame ¶
type PlayerModel ¶
type PlayerModel struct { Me string State PlayerState Game *PlayerGame Status *Status MyCards []*Card }
type PlayerMood ¶
type PlayerMood int
const ( PlayerMoodNone PlayerMood = iota PlayerMoodLost PlayerMood = iota PlayerMoodLostBadly PlayerMood = iota PlayerMoodLostReallyBadly PlayerMood = iota PlayerMoodScared PlayerMood = iota PlayerMoodWinnable PlayerMood = iota PlayerMoodBarelyWinnable PlayerMood = iota PlayerMoodPotato PlayerMood = iota PlayerMoodWon PlayerMood = iota )
func (PlayerMood) JSONString ¶
func (p PlayerMood) JSONString() string
func (PlayerMood) MarshalJSON ¶
func (p PlayerMood) MarshalJSON() ([]byte, error)
func (PlayerMood) MarshalText ¶
func (p PlayerMood) MarshalText() (text []byte, err error)
func (*PlayerMood) UnmarshalJSON ¶
func (p *PlayerMood) UnmarshalJSON(data []byte) error
func (*PlayerMood) UnmarshalText ¶
func (p *PlayerMood) UnmarshalText(text []byte) (err error)
type PlayerState ¶
type PlayerState int
const ( PlayerStateNotJoined PlayerState = iota PlayerStateWaitingForPlayers PlayerState = iota PlayerStateWagerTurn PlayerState = iota PlayerStatePlayCardTurn PlayerState = iota PlayerStateRoundFinished PlayerState = iota )
func (PlayerState) JSONString ¶
func (p PlayerState) JSONString() string
func (PlayerState) MarshalJSON ¶
func (p PlayerState) MarshalJSON() ([]byte, error)
func (PlayerState) MarshalText ¶
func (p PlayerState) MarshalText() (text []byte, err error)
func (*PlayerState) UnmarshalJSON ¶
func (p *PlayerState) UnmarshalJSON(data []byte) error
func (*PlayerState) UnmarshalText ¶
func (p *PlayerState) UnmarshalText(text []byte) (err error)
type PlayerStatus ¶
type PreviousHand ¶
type RemovePlayerAction ¶
type RemovePlayerAction struct {
Player string
}
type Responder ¶
type Responder interface { GetModel() string GetPlayerModel(player string) *PlayerModel Join(player string) (string, error) RemovePlayer(player string) error SetCardsPerPlayer(count int) error SetDeckType(deckType DeckType) error StartRound() error MakeWager(player string, hands int) error PlayCard(player string, card *Card) error FinishRound() error }
type Round ¶
type RoundState ¶
type RoundState int
const ( RoundStateWagers RoundState = iota RoundStateHandInProgress RoundState = iota RoundStateFinished RoundState = iota )
func (RoundState) MarshalJSON ¶
func (r RoundState) MarshalJSON() ([]byte, error)
func (RoundState) MarshalText ¶
func (r RoundState) MarshalText() (text []byte, err error)
func (RoundState) String ¶
func (r RoundState) String() string
type SetCardsPerPlayerAction ¶
type SetCardsPerPlayerAction struct {
Count int
}
type SetDeckTypePlayerAction ¶ added in v0.3.0
type SetDeckTypePlayerAction struct {
DeckType DeckType
}
type SimpleDeck ¶ added in v0.3.0
type SimpleDeck struct { DeckSuits []string SuitRatings map[string]int DeckNumbers []string NumberRatings map[string]int Type DeckType // contains filtered or unexported fields }
func NewDeterministicShuffleDeck ¶
func NewDeterministicShuffleDeck() *SimpleDeck
func NewMiniDeckWithShuffle ¶ added in v0.3.0
func NewMiniDeckWithShuffle(shuffle shuffler) *SimpleDeck
func NewSimpleDeck ¶ added in v0.3.0
func NewSimpleDeck(numbers []string, suits []string, deckType DeckType, shuffle shuffler) *SimpleDeck
func NewStandardDeck ¶
func NewStandardDeck() *SimpleDeck
func NewStandardDeckWithShuffle ¶ added in v0.3.0
func NewStandardDeckWithShuffle(shuffle shuffler) *SimpleDeck
func (*SimpleDeck) CompareNumbers ¶ added in v0.3.0
func (sd *SimpleDeck) CompareNumbers(l string, r string) int
func (*SimpleDeck) CompareSuits ¶ added in v0.3.0
func (sd *SimpleDeck) CompareSuits(l string, r string) int
func (*SimpleDeck) DeckType ¶ added in v0.3.0
func (sd *SimpleDeck) DeckType() DeckType
func (*SimpleDeck) Numbers ¶ added in v0.3.0
func (sd *SimpleDeck) Numbers() []string
func (*SimpleDeck) Shuffle ¶ added in v0.3.0
func (sd *SimpleDeck) Shuffle() shuffler
func (*SimpleDeck) Size ¶ added in v0.3.0
func (sd *SimpleDeck) Size() int
func (*SimpleDeck) Suits ¶ added in v0.3.0
func (sd *SimpleDeck) Suits() []string
type StartRoundAction ¶
type StartRoundAction struct{}
type Status ¶
type Status struct { PlayerStatuses []*PlayerStatus TrumpSuit string NextWagerPlayer string WagerSum int PreviousHand *PreviousHand CurrentHand *CurrentHand }
Click to show internal directories.
Click to hide internal directories.