Documentation ¶
Index ¶
- Constants
- func GetValidMoves(game *CallBreak) ([]deck.Card, error)
- func RegisterStrategy(name string, f func() Strategy) error
- func VerifyStrategy(name string) error
- type Assistant
- type CallBreak
- func (game *CallBreak) AddPlayer(config PlayerConfig) (PlayerId, error)
- func (game *CallBreak) Break(token Token, card deck.Card) error
- func (game *CallBreak) Call(token Token, call Score) error
- func (game *CallBreak) Next() int
- func (game *CallBreak) Query(token Token) (*CallBreak, error)
- func (game *CallBreak) Turn(token *Token) int
- type Config
- type Hand
- type PlayerConfig
- type PlayerId
- type Round
- type Score
- type Stage
- type Strategy
- type Token
- type Trick
Constants ¶
View Source
const ( NCards = 52 NPlayers = 4 NRounds = 5 NTricks = NCards / NPlayers AssistMinTimeout = 50 * time.Millisecond AssistMaxTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func GetValidMoves ¶
return a slice containing cards that can be played by the player with next turn in the ongoing trick
func RegisterStrategy ¶
func VerifyStrategy ¶
Types ¶
type CallBreak ¶
type CallBreak struct { // TODO: think about have a token that provides access to all data in game Players [NPlayers]PlayerId `json:"players"` Rounds [NRounds]Round `json:"rounds"` Stage Stage `json:"stage"` TotalPlayers int `json:"totalplayers"` RoundNumber int `json:"roundnumber"` // contains filtered or unexported fields }
CallBreak implements the callbreak game
func (*CallBreak) AddPlayer ¶
func (game *CallBreak) AddPlayer(config PlayerConfig) (PlayerId, error)
add a player to the game. returns an authentication token on success else return error on failure
type Config ¶
type Config struct { Debug bool `json:"debug,omitempty"` Players []PlayerConfig }
type Hand ¶
type PlayerConfig ¶
type Strategy ¶
func GetStrategy ¶
type Trick ¶
type Trick struct { Cards [NPlayers]deck.Card Lead int // the card position that is 1st in this trick Size int // number of cards played so far in this trick }
func (Trick) SuitWinner ¶
returns index of the winning card of a trick but only considers cards of a given suit -1 if no card of the suit exist
Click to show internal directories.
Click to hide internal directories.