Documentation ¶
Index ¶
Constants ¶
const AceOfSpades = '🂡'
AceOfSpades is the lowest valued card in the deck.
const KingOfClubs = '🃞'
KingOfClubs is the highest valued non-trump card in the deck.
const TheFool = '🃠'
TheFool is the lowest valued trump card in the deck.
const TheWorld = '🃵'
TheWorld is the highest valued trump card in the deck.
Variables ¶
var FrenchCards = make([]rune, 52)
FrenchCards is a deck of 52 standard French cards.
var FrenchColors = []rune{'B', 'R'}
FrenchColors are the colors present in a standard French deck of cards (black and red).
var FrenchSuits = []rune{'♠', '♡', '♢', '♣'}
FrenchSuits are the four suits present in a standard French deck of cards.
var FrenchValues = []rune{'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K'}
FrenchValues are the thirteen values of cards for each suit in a standard French deck of cards.
var TarotDeMarseilleCards = make([]rune, 78)
TarotDeMarseilleCards is a deck of 78 Tarot de Marseille cards.
var TarotDeMarseilleSuits = []rune{'♣', '⚔', '⛾', '⛤'}
TarotDeMarseilleSuits are the four suits present in a Tarot de Marseille deck of cards.
var TarotDeMarseilleTrumps = []string{"0", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX", "XXI"}
TarotDeMarseilleTrumps are the 22 trump cards in a Tarot de Marseille deck of cards.
var TarotDeMarseilleValues = []rune{'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'N', 'Q', 'K'}
TarotDeMarseilleValues are the fourteen values of cards for each suit in a Tarot de Marseille deck of cards.
Functions ¶
func TranslateFrench ¶
TranslateFrench translates a playing card rune into a text name.
func TranslateTarotDeMarseille ¶
TranslateTarotDeMarseille translates a playing card rune into a text name.
Types ¶
type Combined ¶
type Combined struct { RandomObject DiceBag Deck // contains filtered or unexported fields }
Combined embeds a DiceBag and a Deck.
func NewCombined ¶
NewCombined creates a new DiceBag and Deck simultaneously
func (*Combined) CountDistinctOutcomes ¶
CountDistinctOutcomes implements RandomObject interface.
func (*Combined) NextOutcome ¶
NextOutcome implements RandomObject interface.
type Deck ¶
type Deck struct { RandomObject // contains filtered or unexported fields }
Deck represents a deck of playing cards.
func NewStandardFrenchDeck ¶
func NewStandardFrenchDeck() *Deck
NewStandardFrenchDeck builds a 52-card deck with four French suits (clubs, hearts, diamonds, spades) and thirteen French values (ace through king)
func NewTarotDeMarseilleDeck ¶
func NewTarotDeMarseilleDeck() *Deck
NewTarotDeMarseilleDeck builds a 78-card deck with four Italian suits (clubs, swords, cups, coins) of fourteen values (ace through king including knight between jack and queen) and 22 trumps (0 through XXI).
func (*Deck) CountDistinctOutcomes ¶
CountDistinctOutcomes implements RandomObject interface.
func (*Deck) NextOutcome ¶
NextOutcome implements RandomObject interface.
type DiceBag ¶
type DiceBag struct { RandomObject // contains filtered or unexported fields }
DiceBag represents a bag of individual dice.
func NewDiceBag ¶
NewDiceBag creates a new bag of dice from a collection of dice.
func (*DiceBag) CountDistinctOutcomes ¶
CountDistinctOutcomes implements RandomObject interface.
func (*DiceBag) NextOutcome ¶
NextOutcome implements RandomObject interface.
type Drawer ¶
Drawer is an interface to a collection of randomly-sorted objects, from which a single value can be drawn.
type RandomObject ¶
type RandomObject interface { MaxDraws() int CountDistinctOutcomes(k int) *big.Int NextOutcome(k int) []rune Translate(r rune) (string, error) }
RandomObject is an interface to a thing that can draw random elements from a fixed set (like a deck of cards or a single die).