Documentation ¶
Index ¶
- func SearchByID(list []models.Player, id string) (*models.Player, int, error)
- func SelectRandom(cards [52]models.Card, selected int) (models.Card, int)
- func SelectRandomN(s int) (int, int)
- func SendToAll(players []models.Player, event *models.Event)
- func SendToChanTimeout(out chan []byte, event *models.Event) error
- func SendToChanTimeoutD(out chan []byte, event *models.Event, d time.Duration) error
- func SendToPlayerInListTimeout(players []models.Player, i int, event *models.Event) error
- func SendToPlayerTimeout(player *models.Player, event *models.Event) error
- func WaitUntilCloseOrEvent(player *models.Player) (*models.Event, error)
- func WaitUntilCloseOrEventD(in chan *models.Event, close chan bool, d time.Duration) (*models.Event, error)
- func WaitUntilEventD(in chan *models.Event, d time.Duration) (*models.Event, error)
- type CardGenerator
- type PlayerQueue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SelectRandom ¶
SelectRandom randomly selects a card from the stack and returns a copy of it
func SelectRandomN ¶
func SendToAll ¶
SendToAll is a utility for sending an event (message) to an entire array (lobby) of players.
func SendToChanTimeoutD ¶
func SendToPlayerInListTimeout ¶
SendToPlayerInList is a utility for sending an event (message) to a specific player in a slice
func SendToPlayerTimeout ¶
SendToPlayer is a utility for sending an event (message) to a given player
func WaitUntilCloseOrEvent ¶
WaitUntilEvent waits for a player event before a timeout succeeds.
Types ¶
type CardGenerator ¶
CardGenerator is a utility for randomly choose a multiple cards out of a 52 card deck
func NewCardSelector ¶
func NewCardSelector() *CardGenerator
NewCardSelector creates a new card select
func (*CardGenerator) Reset ¶
func (s *CardGenerator) Reset()
Reset resets the card stack and therefore the probabilities
func (*CardGenerator) SelectRandom ¶
func (s *CardGenerator) SelectRandom() (c models.Card)
SelectRandom randomly selects a card from the stack and returns a copy of it