cardware

package
v0.0.0-...-fbe4ea2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AceOfSpades = '🂡'

AceOfSpades is the lowest valued card in the deck.

View Source
const KingOfClubs = '🃞'

KingOfClubs is the highest valued non-trump card in the deck.

View Source
const TheFool = '🃠'

TheFool is the lowest valued trump card in the deck.

View Source
const TheWorld = '🃵'

TheWorld is the highest valued trump card in the deck.

Variables

View Source
var FrenchCards = make([]rune, 52)

FrenchCards is a deck of 52 standard French cards.

View Source
var FrenchColors = []rune{'B', 'R'}

FrenchColors are the colors present in a standard French deck of cards (black and red).

View Source
var FrenchSuits = []rune{'♠', '♡', '♢', '♣'}

FrenchSuits are the four suits present in a standard French deck of cards.

View Source
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.

View Source
var TarotDeMarseilleCards = make([]rune, 78)

TarotDeMarseilleCards is a deck of 78 Tarot de Marseille cards.

View Source
var TarotDeMarseilleSuits = []rune{'♣', '⚔', '⛾', '⛤'}

TarotDeMarseilleSuits are the four suits present in a Tarot de Marseille deck of cards.

View Source
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.

View Source
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 NewWordList

func NewWordList(r io.Reader, minWordLength int) []string

func TranslateFrench

func TranslateFrench(r rune) (string, error)

TranslateFrench translates a playing card rune into a text name.

func TranslateTarotDeMarseille

func TranslateTarotDeMarseille(r rune) (string, error)

TranslateTarotDeMarseille translates a playing card rune into a text name.

Types

type Card

type Card rune

Card represents a single card in a deck of playing cards.

type Combined

type Combined struct {
	RandomObject
	DiceBag
	Deck
	// contains filtered or unexported fields
}

Combined embeds a DiceBag and a Deck.

func NewCombined

func NewCombined(dice []int) *Combined

NewCombined creates a new DiceBag and Deck simultaneously

func (*Combined) CountDistinctOutcomes

func (c *Combined) CountDistinctOutcomes(k int) *big.Int

CountDistinctOutcomes implements RandomObject interface.

func (*Combined) MaxDraws

func (c *Combined) MaxDraws() int

MaxDraws implements RandomObject interface.

func (*Combined) NextOutcome

func (c *Combined) NextOutcome(k int) []rune

NextOutcome implements RandomObject interface.

func (*Combined) Translate

func (c *Combined) Translate(r rune) (string, error)

Translate 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) Card

func (d *Deck) Card(n int) Card

Card gets the nth card from the deck with no bounds checking

func (*Deck) CountDistinctOutcomes

func (d *Deck) CountDistinctOutcomes(k int) *big.Int

CountDistinctOutcomes implements RandomObject interface.

func (*Deck) MaxDraws

func (d *Deck) MaxDraws() int

MaxDraws implements RandomObject interface.

func (*Deck) NextOutcome

func (d *Deck) NextOutcome(k int) []rune

NextOutcome implements RandomObject interface.

func (*Deck) Translate

func (d *Deck) Translate(r rune) (string, error)

Translate implements RandomObject interface.

type DiceBag

type DiceBag struct {
	RandomObject
	// contains filtered or unexported fields
}

DiceBag represents a bag of individual dice.

func NewDiceBag

func NewDiceBag(dice []int) *DiceBag

NewDiceBag creates a new bag of dice from a collection of dice.

func (*DiceBag) CountDistinctOutcomes

func (d *DiceBag) CountDistinctOutcomes(k int) *big.Int

CountDistinctOutcomes implements RandomObject interface.

func (*DiceBag) MaxDraws

func (d *DiceBag) MaxDraws() int

MaxDraws implements RandomObject interface.

func (*DiceBag) NextOutcome

func (d *DiceBag) NextOutcome(k int) []rune

NextOutcome implements RandomObject interface.

func (*DiceBag) Translate

func (d *DiceBag) Translate(r rune) (string, error)

Translate implements RandomObject interface.

type Drawer

type Drawer interface {
	HasRemaining() bool
	Draw() (string, error)
}

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).

type Shuffler

type Shuffler interface {
	Shuffle(src rand.Source)
}

Shuffler is an interface to a thing that can be shuffled.

type WordList

type WordList []string

WordList repreents a parsed word list file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL