Documentation
¶
Index ¶
- Variables
- func Draw(amount int) func(cards []Card) ([]Card, []Card)
- func Filter(f func(Card) bool) func([]Card) []Card
- func Less(cards []Card) func(i, j int) bool
- func Sort(less func(cards []Card) func(i, j int) bool) func([]Card) []Card
- func WithDecks(amount int) func([]Card) []Card
- func WithJokers(amount int) func([]Card) []Card
- type Card
- type Rank
- type Suit
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Draw ¶
Draw removes the given amount of cards from the end and returns it as the first return value. The second return value are the remaining cards in the deck.
func Filter ¶
Filter applies the given filter to the deck and returns it. Can be used as an option when creating a deck using New.
func Sort ¶ added in v1.1.0
Sort takes a less function and applies it to the cards. Can be used as an option when creating a deck using New.
func WithDecks ¶ added in v1.4.0
WithDecks puts the given amount of decks in a deck (52 * amount). Can be used as an option when creating a deck using New.
func WithJokers ¶ added in v1.4.0
WithJokers puts the passed amount of jokers, with the Suit Joker, in the deck without a Rank. Can be used as an option when creating a deck using New.
Types ¶
type Card ¶
func DefaultSort ¶ added in v1.1.0
DefaultSort sorts the cards using the Less function Can be used as an option when creating a deck using New.
func New ¶
New creates a new 52 card deck using the default Suits Spade, Diamond, Club and Heart Can take options to configure it as desired.
func Shuffle ¶
Shuffle randomizes the deck. Can be used as an option when creating a deck using New.