Documentation ¶
Index ¶
- type Card
- type Cards
- type Deck
- type Draw
- type Pile
- func (z *Pile) AddCardsToPile(draw *Draw, cards Cards)
- func (z *Pile) GetCardAtID(index int) (*Draw, error)
- func (z *Pile) GetCardsFromPile(cards Cards) *Draw
- func (z *Pile) Marshal() ([]byte, error)
- func (z *Pile) PickAllCardsFromPile() *Draw
- func (z *Pile) PickAmountOfCardsFromBottomOfPile(amount int) *Draw
- func (z *Pile) PickAmountOfCardsFromTopOfPile(amount int) *Draw
- func (z *Pile) RetrieveCardsInPile() (cards Cards)
- func (z *Pile) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Card ¶
type Card struct { Value string `json:"value"` Suit string `json:"suit"` Code string `json:"code"` DeckID string `json:"deckId"` // contains filtered or unexported fields }
Card is a type that implements the structure of a Card.
type Cards ¶ added in v1.1.0
type Cards []*Card
Cards A type that represents a slice of cards to make the code easier to read and easier to use in other type definitions
type Deck ¶
type Deck struct { Remaining int `json:"remaining"` DeckID string `json:"deckId"` Success bool `json:"success"` Shuffled bool `json:"shuffled"` // contains filtered or unexported fields }
Deck is a type that implements the structure of a Deck.
func NewDeck ¶
NewDeck creates an unshuffled amount of decks requested by the parameter (amount). These decks do not contain jokers.
func NewDeckWithJokers ¶ added in v1.0.2
NewDeckWithJokers creates an unshuffled amount of decks requested by the parameter (amount). These decks do contain jokers.
func ShuffleDeck ¶
ShuffleDeck shuffles the deck that has been passed as a parameter.
func UnmarshalDeck ¶
UnmarshalDeck unmarshals a byte array into a pointer to a Deck for internal use.
type Draw ¶
type Draw struct { Success bool `json:"success"` Cards Cards `json:"cards"` Remaining int `json:"remaining"` }
Draw is a type that implements the structure of a Draw.
func UnmarshalDraw ¶
UnmarshalDraw unmarshals a byte array into a pointer to a Draw for internal use.
func (*Draw) AreAllCardsInThisDraw ¶ added in v1.1.0
AreAllCardsInThisDraw returns true if all the cards in the cards slice are in the draw.
type Pile ¶
Pile is a type that implements the structure of a Draw.
func ShufflePile ¶ added in v1.1.0
ShufflePile returns a shuffled pile
func UnmarshalPile ¶ added in v1.1.1
UnmarshalPile unmarshals a byte array into a pointer to a Pile for internal use.
func (*Pile) AddCardsToPile ¶
AddCardsToPile adds all the cards in the cards parameter that are present in the Draw to the pile.
func (*Pile) GetCardAtID ¶ added in v1.1.0
GetCardAtID returns the card at the id from the pile.
func (*Pile) GetCardsFromPile ¶
GetCardsFromPile returns the specified cards from the pile as a Draw.
func (*Pile) Marshal ¶ added in v1.1.1
Marshal marshals a pointer to a Pile into a byte array for transmission.
func (*Pile) PickAllCardsFromPile ¶
PickAllCardsFromPile returns all the cards in the pile as a Draw and clears the pile.
func (*Pile) PickAmountOfCardsFromBottomOfPile ¶
PickAmountOfCardsFromBottomOfPile returns a Draw of the amount selected from the bottom of the pile.
func (*Pile) PickAmountOfCardsFromTopOfPile ¶
PickAmountOfCardsFromTopOfPile returns a Draw of the amount selected from the top of the pile.
func (*Pile) RetrieveCardsInPile ¶
RetrieveCardsInPile returns a copy of all cards in the pile