Documentation ¶
Overview ¶
Cards is a Go library of types and functions for operating on playing cards.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ISWINDOWS = DEFAULTISWINDOWS DEFAULTISWINDOWS = func() bool { return runtime.GOOS == "windows" } )
Function to test whether the operating system is Windows. Declared as a variable so that it can be overridden in unit tests.
var Characters = map[Suit]string{ SPADES: "S", HEARTS: "H", DIAMONDS: "D", CLUBS: "C", }
var Glyphs = map[Suit]string{ SPADES: string('\u2660'), HEARTS: string('\u2661'), DIAMONDS: string('\u2662'), CLUBS: string('\u2663'), }
PinochleRanks lists the acceptable ranks in a Pinochle deck in reverse order of their precedence
var RegularRanks = []Rank{ TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE, }
A slice of the four suits
Functions ¶
This section is empty.
Types ¶
type Deck ¶
type Deck struct {
// contains filtered or unexported fields
}
Deck is the abstract base type for RegularDeck and PinochleDeck
type PinochleDeck ¶
type PinochleDeck struct {
Deck
}
PinochleDeck is a subtype of Deck for the Pinochle game
func NewPinochleDeck ¶
func NewPinochleDeck() PinochleDeck
NewPinochleDeck constructs a 48-card Pinochle deck.
func (*PinochleDeck) Sort ¶ added in v1.3.0
func (pd *PinochleDeck) Sort()
Sort sorts the deck in place using the Pinochle ordering of ranks.
type Rank ¶
type Rank int
A rank is one of the 13 levels of cards in a deck.
type RegularDeck ¶ added in v1.1.1
type RegularDeck struct {
Deck
}
RegularDeck is a subtype of the abstract type Deck
func NewRegularDeck ¶ added in v1.1.1
func NewRegularDeck() RegularDeck
NewRegularDeck constructs a 52-card regular deck.
func (*RegularDeck) Sort ¶ added in v1.3.0
func (rd *RegularDeck) Sort()
Sort sorts the deck in place using the regular ordering.
type Suit ¶
type Suit int