cards

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ace   = "ace"
	Two   = "two"
	Three = "three"
	Four  = "four"
	Five  = "five"
	Six   = "six"
	Seven = "seven"
	Eight = "eight"
	Nine  = "nine"
	Ten   = "ten"
	Jack  = "jack"
	Queen = "queen"
	King  = "king"
)
View Source
const (
	Spades  = "spades"
	Diamond = "diamond"
	Clubs   = "clubs"
	Hearts  = "hearts"
)

Variables

View Source
var Blackjack = map[string]int{
	Two:   2,
	Three: 3,
	Four:  4,
	Five:  5,
	Six:   6,
	Seven: 7,
	Eight: 8,
	Nine:  9,
	Ten:   10,
	Jack:  10,
	Queen: 10,
	King:  10,
	Ace:   11,
}

Functions

This section is empty.

Types

type Card

type Card struct {
	Suit  string // Suit of the card (e.g., "hearts")
	Rank  string // Rank of the card (e.g., "ace")
	Value int    // Value of the card for game calculations
	Index int    // Index of the card in a deck
}

func NewCard

func NewCard(suit, rank string, value int) *Card

func (*Card) BlackjackAce

func (c *Card) BlackjackAce() bool

func (*Card) BlackjackTen

func (c *Card) BlackjackTen() bool

type Deck

type Deck struct {
	Cards []Card
}

func NewDeck

func NewDeck(s []string, r map[string]int, copies int) *Deck

func (*Deck) Search

func (deck *Deck) Search(suit, rank string) []Card

type Shoe

type Shoe struct {
	ForceShuffle bool // Flag to force a shuffle
	ShoeReport   ShoeReport
	// contains filtered or unexported fields
}

func NewShoe

func NewShoe(deck Deck, numberOfDecks int, penetration float64) *Shoe

func (*Shoe) CardsDiscarded

func (s *Shoe) CardsDiscarded() int

func (*Shoe) CardsInplay

func (s *Shoe) CardsInplay() int

func (*Shoe) CardsUndealt

func (s *Shoe) CardsUndealt() int

func (*Shoe) Discard

func (s *Shoe) Discard(card *Card)

func (*Shoe) Draw

func (s *Shoe) Draw() *Card

func (*Shoe) GetReport

func (s *Shoe) GetReport() *ShoeReport

func (*Shoe) ShouldShuffle

func (s *Shoe) ShouldShuffle() bool

func (*Shoe) Shuffle

func (s *Shoe) Shuffle() (err error)

func (*Shoe) ShuffleDiscards

func (s *Shoe) ShuffleDiscards() (err error)

func (*Shoe) ShuffleDiscardsFisherYates

func (s *Shoe) ShuffleDiscardsFisherYates() (err error)

type ShoeReport

type ShoeReport struct {
	NumberOfDecks    int
	NumberOfCards    int
	CutCard          int
	NumberOfShuffles int64
	NumberOutOfCards int64
}

Jump to

Keyboard shortcuts

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