playingcards

package
v0.0.0-...-6b15219 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package playingcards is a convenience package that helps define and work with a set of american playing cards.

Index

Constants

View Source
const (
	//display:"\uFFFD"
	SuitUnknown = iota
	//display:"\u2660"
	SuitSpades
	//display:"\u2665"
	SuitHearts
	//display:"\u2663"
	SuitClubs
	//display:"\u2666"
	SuitDiamonds
	//dislay:"Jokers"
	SuitJokers
)
View Source
const (
	RankUnknown = iota
	RankAce
	Rank2
	Rank3
	Rank4
	Rank5
	Rank6
	Rank7
	Rank8
	Rank9
	Rank10
	RankJack
	RankQueen
	RankKing
	RankJoker
)

Variables

View Source
var RankEnum = enums.MustAdd("Rank", map[int]string{
	Rank10:      "10",
	Rank2:       "2",
	Rank3:       "3",
	Rank4:       "4",
	Rank5:       "5",
	Rank6:       "6",
	Rank7:       "7",
	Rank8:       "8",
	Rank9:       "9",
	RankAce:     "Ace",
	RankJack:    "Jack",
	RankJoker:   "Joker",
	RankKing:    "King",
	RankQueen:   "Queen",
	RankUnknown: "Unknown",
})

RankEnum is the enum.Enum for Rank

View Source
var SuitEnum = enums.MustAdd("Suit", map[int]string{
	SuitClubs:    "\u2663",
	SuitDiamonds: "\u2666",
	SuitHearts:   "\u2665",
	SuitJokers:   "Jokers",
	SuitSpades:   "\u2660",
	SuitUnknown:  "\uFFFD",
})

SuitEnum is the enum.Enum for Suit

Functions

func NewDeck

func NewDeck(withJokers bool) *boardgame.Deck

NewDeck returns a new deck of playing cards with or without Jokers in a canonical, stable order, ready for being added to a chest.

func NewDeckMulti

func NewDeckMulti(count int, withJokers bool) *boardgame.Deck

NewDeckMulti is like NewDeck, but returns count normal decks together, in canonical order. Useful for e.g. casino games where there might be four decks shuffled together for the draw stack.

Types

type Card

type Card struct {
	base.ComponentValues
	Suit enum.Val
	Rank enum.Val
}

Card is a struct, ready for use in your own package without modification, that encodes the notion of a typical playing card.

func (*Card) Reader

func (c *Card) Reader() boardgame.PropertyReader

Reader returns an autp-generated boardgame.PropertyReader for Card

func (*Card) String

func (c *Card) String() string

Jump to

Keyboard shortcuts

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