blackjack

package
v0.0.0-...-a5e6680 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	Name string
	Suit Suit
}

Store cards as their values

func (Card) Print

func (c Card) Print()

func (Card) Value

func (c Card) Value() int

type Deck

type Deck struct {
	Cards []Card
}

func NewDeck

func NewDeck() *Deck

func (*Deck) AppendCard

func (d *Deck) AppendCard(c Card)

func (*Deck) Print

func (d *Deck) Print()

func (*Deck) Shuffle

func (d *Deck) Shuffle()

func (*Deck) TakeTopCard

func (d *Deck) TakeTopCard() Card

type Hand

type Hand struct {
	Cards  []Card
	Status HandStatus
}

func (*Hand) AddCard

func (h *Hand) AddCard(c Card)

func (*Hand) IsSoft

func (h *Hand) IsSoft() bool

func (*Hand) Print

func (h *Hand) Print()

func (*Hand) Split

func (h *Hand) Split(c Card) Hand

func (*Hand) Value

func (h *Hand) Value() int

type HandStatus

type HandStatus uint8
const (
	Active HandStatus = iota
	Stand
	Busted
)

type Shoe

type Shoe struct {
	Cards []Card
	Size  int
	Count int
}

func NewShoe

func NewShoe(size int) *Shoe

func (*Shoe) Print

func (s *Shoe) Print()

func (*Shoe) Shuffle

func (s *Shoe) Shuffle()

func (*Shoe) TakeCard

func (s *Shoe) TakeCard() Card

type Suit

type Suit uint8
const (
	Spades Suit = iota
	Clubs
	Diamonds
	Hearts
)

func (Suit) Char

func (s Suit) Char() string

func (Suit) Color

func (s Suit) Color() color.Attribute

type Table

type Table struct {
	Shoe    *Shoe
	Rules   TableRule
	Hand    [][]Hand
	TurnIdx int
	Scanner *bufio.Scanner
}

func (*Table) StartRound

func (t *Table) StartRound()

type TableRule

type TableRule uint8
const (
	SS17 TableRule = iota << 1
	HH17
	BJ32
)

Jump to

Keyboard shortcuts

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