deck

package
v0.0.0-...-42aaa2b Latest Latest
Warning

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

Go to latest
Published: May 17, 2017 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package deck is a generated protocol buffer package.

It is generated from these files:

deck/deck.proto

It has these top-level messages:

Card

Index

Constants

This section is empty.

Variables

View Source
var Card_Rank_name = map[int32]string{
	0:  "UNKNOWN_RANK",
	1:  "ACE",
	2:  "TWO",
	3:  "THREE",
	4:  "FOUR",
	5:  "FIVE",
	6:  "SIX",
	7:  "SEVEN",
	8:  "EIGHT",
	9:  "NINE",
	10: "TEN",
	11: "JACK",
	12: "QUEEN",
	13: "KING",
}
View Source
var Card_Rank_value = map[string]int32{
	"UNKNOWN_RANK": 0,
	"ACE":          1,
	"TWO":          2,
	"THREE":        3,
	"FOUR":         4,
	"FIVE":         5,
	"SIX":          6,
	"SEVEN":        7,
	"EIGHT":        8,
	"NINE":         9,
	"TEN":          10,
	"JACK":         11,
	"QUEEN":        12,
	"KING":         13,
}
View Source
var Card_Suit_name = map[int32]string{
	0: "UNKNOWN_SUIT",
	1: "HEARTS",
	2: "DIAMONDS",
	3: "CLUBS",
	4: "SPADES",
}
View Source
var Card_Suit_value = map[string]int32{
	"UNKNOWN_SUIT": 0,
	"HEARTS":       1,
	"DIAMONDS":     2,
	"CLUBS":        3,
	"SPADES":       4,
}

Functions

func CardString

func CardString(c Card) string

func RankString

func RankString(r Card_Rank) string

func Sequential

func Sequential(card1, card2 Card) bool

func SuitString

func SuitString(s Card_Suit) string

Types

type ByRank

type ByRank []Card

Sort cards by rank only.

func (ByRank) Len

func (b ByRank) Len() int

func (ByRank) Less

func (b ByRank) Less(i, j int) bool

func (ByRank) Swap

func (b ByRank) Swap(i, j int)

type BySuitAndRank

type BySuitAndRank []Card

Sort cards by suit and then rank.

func (BySuitAndRank) Len

func (b BySuitAndRank) Len() int

func (BySuitAndRank) Less

func (b BySuitAndRank) Less(i, j int) bool

func (BySuitAndRank) Swap

func (b BySuitAndRank) Swap(i, j int)

type Card

type Card struct {
	Suit Card_Suit `protobuf:"varint,1,opt,name=suit,enum=deck.Card_Suit" json:"suit,omitempty"`
	Rank Card_Rank `protobuf:"varint,2,opt,name=rank,enum=deck.Card_Rank" json:"rank,omitempty"`
}

func (*Card) Descriptor

func (*Card) Descriptor() ([]byte, []int)

func (*Card) GetRank

func (m *Card) GetRank() Card_Rank

func (*Card) GetSuit

func (m *Card) GetSuit() Card_Suit

func (*Card) ProtoMessage

func (*Card) ProtoMessage()

func (*Card) Reset

func (m *Card) Reset()

func (*Card) String

func (m *Card) String() string

type Card_Rank

type Card_Rank int32
const (
	Card_UNKNOWN_RANK Card_Rank = 0
	Card_ACE          Card_Rank = 1
	Card_TWO          Card_Rank = 2
	Card_THREE        Card_Rank = 3
	Card_FOUR         Card_Rank = 4
	Card_FIVE         Card_Rank = 5
	Card_SIX          Card_Rank = 6
	Card_SEVEN        Card_Rank = 7
	Card_EIGHT        Card_Rank = 8
	Card_NINE         Card_Rank = 9
	Card_TEN          Card_Rank = 10
	Card_JACK         Card_Rank = 11
	Card_QUEEN        Card_Rank = 12
	Card_KING         Card_Rank = 13
)

func NextRank

func NextRank(rank Card_Rank) Card_Rank

func (Card_Rank) EnumDescriptor

func (Card_Rank) EnumDescriptor() ([]byte, []int)

func (Card_Rank) String

func (x Card_Rank) String() string

type Card_Suit

type Card_Suit int32
const (
	Card_UNKNOWN_SUIT Card_Suit = 0
	Card_HEARTS       Card_Suit = 1
	Card_DIAMONDS     Card_Suit = 2
	Card_CLUBS        Card_Suit = 3
	Card_SPADES       Card_Suit = 4
)

func (Card_Suit) EnumDescriptor

func (Card_Suit) EnumDescriptor() ([]byte, []int)

func (Card_Suit) String

func (x Card_Suit) String() string

type Deck

type Deck []Card

func New

func New() Deck

func (*Deck) Pop

func (d *Deck) Pop() Card

Take and return the top card from the Deck.

func (Deck) Shuffle

func (d Deck) Shuffle()

Shuffle randomizes the order of the cards in the Deck using Fisher–Yates shuffle.

Jump to

Keyboard shortcuts

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