models

package
v0.0.0-...-a0b16b4 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCard

func NewCard(rank Rank, suit Suit) (*card, error)

func NewCommunityCards

func NewCommunityCards(cards ...Card) *communityCards

func NewDealtCards

func NewDealtCards(c ...Card) *dealtCards

func NewDeck

func NewDeck() *deck

func NewHand

func NewHand(cards []Card) *hand

Types

type Card

type Card interface {
	Equals(Card) bool
	EqualsRank(Card) bool
	EqualsSuit(Card) bool
	GetRank() Rank
	GetSuit() Suit
	GreaterThan(Card) bool
	LessThan(Card) bool
	RankDifference(Card) int
	String() string
	Valid() bool
}

type CommunityCards

type CommunityCards interface {
	Clone() CommunityCards
	GetAllCards() []Card
	GetOpenedCards() []Card
	GetUnopenedCards() []Card
	SetUnopenedCards(cards []Card)
}

type DealtCards

type DealtCards interface {
	GetCards() []Card
	SetUnknownDealtCards(...Card)
}

type Deck

type Deck interface {
	AddCards([]Card)
	Contains(Card) bool
	Burn()
	PopCardsFromTop(int) []Card
	RemoveCards([]Card)
}

type Hand

type Hand interface {
	Compare(Hand) int
	GetHandType() HandType
	GetTieBreakerCardsOrder() []Card
	SetHandType()
	String() string
}

type HandType

type HandType int
const (
	RoyalFlush HandType = iota
	StraightFlush
	FourOfAKind
	FullHouse
	Flush
	Straight
	ThreeOfAKind
	TwoPairs
	Pair
	HighCard
	Default
)

type Rank

type Rank string

type Suit

type Suit rune

Jump to

Keyboard shortcuts

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