deck

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT, MIT Imports: 6 Imported by: 1

README

Deck

Usage

1, 2, 3.. start
// declare a Deck
d := deck.New()

// you Pick a card, like a pillow
card, err := d.Pick()
More...
// get card points
// TODO:
// points = 10
Even more...
// let's drop the `expendable` card, aka `2 di spade`
err := d.Drop()
// err = true, if we Pick-ed a card before. Drop should be done just after the
// Shuffle()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deck

type Deck struct {
	// contains filtered or unexported fields
}

Deck struct

func New

func New() (d Deck)

New deck. Shuffling will reset the game

func (*Deck) Drop

func (d *Deck) Drop() error

Drop a card only before the first Pick. Think of three players game

func (*Deck) Pick

func (d *Deck) Pick() (c card.Card, err error)

Pick a card from deck

Jump to

Keyboard shortcuts

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