Documentation ¶
Index ¶
- func ComparePresentations(a, b []Card) int
- func GetValidPresentations(hand []Card) [][]Card
- func IsValidPresentation(presentation []Card) bool
- type Card
- type Game
- func (g *Game) AddPlayer(id, name string) error
- func (g *Game) CanPlayerPresent(playerId string) bool
- func (g *Game) DecideHandOrientation(playerId string, flip bool) error
- func (g *Game) GetCurrentPlayer() *Player
- func (g *Game) GetPlayerById(id string) *Player
- func (g *Game) GetPlayerIndex(id string) (int, error)
- func (g *Game) HasEnoughPlayers() bool
- func (g *Game) HavePlayersDecidedHandOrientation() bool
- func (g *Game) IsEmpty() bool
- func (g *Game) IsFull() bool
- func (g *Game) IsGameOver() bool
- func (g *Game) IsLobby() bool
- func (g *Game) Pass(playerId string) error
- func (g *Game) PlayablePresentations(playerId string) [][]Card
- func (g *Game) Present(playerId string, start, end int) error
- func (g *Game) Prospect(playerId string, left, flip bool, position int) error
- func (g *Game) RemovePlayer(id string)
- func (g *Game) Start() error
- type Player
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparePresentations ¶
ComparePresentations compares the value of two presentations (assumed to be valid), and returns 1 if the value of a is greater, -1 if the value of b is greater, and 0 if they have the same value. This function is usable with the slices.SortFunc function to rank presentations.
func GetValidPresentations ¶
GetValidPresentations identifies the groups of cards in a hand that could be presented together. The results are sorted from least to most valuable.
func IsValidPresentation ¶
Types ¶
type Game ¶
type Game struct { Id string Round int CurrentPlayer int LastPlayerToPresent int Presentation []Card Players []Player Rand *rand.Rand }
func (*Game) CanPlayerPresent ¶
func (*Game) DecideHandOrientation ¶
func (*Game) GetCurrentPlayer ¶
func (*Game) GetPlayerById ¶
func (*Game) HasEnoughPlayers ¶
func (*Game) HavePlayersDecidedHandOrientation ¶
func (*Game) IsGameOver ¶
func (*Game) PlayablePresentations ¶
func (*Game) RemovePlayer ¶
Click to show internal directories.
Click to hide internal directories.