godeck

package module
v0.0.0-...-420f642 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

godeck

A Golang representation for a deck of cards, a shuffling algorithm, and ability to go to 2 or more decks of cards.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	Suit  string
	Value string
}

func (Card) String

func (c Card) String() string

type Deck

type Deck struct {
	Cards     []Card
	NumDecks  int
	Jokers    bool
	NumJokers int
}

func NewDeck

func NewDeck(NumDecks int, Jokers bool, NumJokers int) *Deck

func (*Deck) Deal

func (d *Deck) Deal() Card

type DiscardPile

type DiscardPile struct {
	Cards *arraystack.Stack
}

func NewDiscardPile

func NewDiscardPile() *DiscardPile

func (*DiscardPile) AddCard

func (d *DiscardPile) AddCard(c Card)

func (*DiscardPile) Peek

func (d *DiscardPile) Peek() Card

if nil is returned, the discard pile is empty

func (*DiscardPile) RemoveCard

func (d *DiscardPile) RemoveCard() Card

func (*DiscardPile) Size

func (d *DiscardPile) Size() int

func (*DiscardPile) TakeAll

func (d *DiscardPile) TakeAll() []Card

type PlayerHand

type PlayerHand struct {
	Cards []Card
}

func (*PlayerHand) AddCard

func (h *PlayerHand) AddCard(c Card)

func (*PlayerHand) AddCards

func (h *PlayerHand) AddCards(cards []Card)

func (*PlayerHand) RemoveCard

func (h *PlayerHand) RemoveCard(i int) Card

Jump to

Keyboard shortcuts

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