set

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 5 Imported by: 20

Documentation

Index

Constants

View Source
const DeckSize = 40

DeckSize of a cards of cards

Variables

This section is empty.

Functions

func Move

func Move(from, to *Cards)

Move moves all cards from first to second set in parameters

func MoveOne added in v0.1.1

func MoveOne(c *card.Item, from, to *Cards) error

MoveOne moves one card from first to second set in parameters

Types

type Cards

type Cards []card.Item

Cards type

func Deck

func Deck() (cards Cards)

Deck returns a full shuffled deck with all the 40 cards

func NewMust

func NewMust[T constraints.Integer](ids ...T) *Cards

NewMust creates a set of cards with ids that must be valid (from 1 to 40) or else it will panic

func (*Cards) Add

func (cards *Cards) Add(ids ...card.Item)

Add appends cards to the set

func (*Cards) Clear

func (cards *Cards) Clear()

Clear removes all cards from the set

func (*Cards) Find

func (cards *Cards) Find(id card.Item) int

Find returns the index of the card given in input or -1 if not found (to change with error)

func (*Cards) Top

func (cards *Cards) Top() card.Item

Top func return the top card of the set and deletes from it

Jump to

Keyboard shortcuts

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