Documentation ¶
Index ¶
- Constants
- Variables
- type ByCombination
- type ByCombinationReversed
- type ByFace
- type ByFaceReversed
- type Card
- type Combination
- func CombinationsOf(cards []Card, combinationStrengths []CombinationType, shortDeck bool) ([]Combination, error)
- func NewCombination(cards []Card, combinationStrengths []CombinationType, shortDeck bool) (*Combination, error)
- func NewDefaultCombination(cards []Card) (*Combination, error)
- func NewShortDeckCombination(cards []Card) (*Combination, error)
- func StrongestCombinationOf(cards []Card, combinationStrengths []CombinationType, shortDeck bool) (*Combination, error)
- func (r Combination) AllCards() []Card
- func (r Combination) CombinationStrengths() []CombinationType
- func (r Combination) HighestCardFace() Face
- func (r Combination) Kickers() []Card
- func (r Combination) Less(other Combination) bool
- func (r Combination) MainCard() Face
- func (r Combination) More(other Combination) bool
- func (r Combination) SecondaryCard() *Face
- func (r Combination) Tie(other Combination) bool
- func (r Combination) Type() CombinationType
- type CombinationType
- type Deck
- func (d *Deck) CardIsDrawn(card Card) bool
- func (d *Deck) CardIsLeft(card Card) bool
- func (d *Deck) Collect()
- func (d *Deck) CollectAndShuffle()
- func (d *Deck) ContainsCard(card Card) bool
- func (d *Deck) Draw() (*Card, error)
- func (d Deck) IsEmpty() bool
- func (d *Deck) MoveToDrawn(card Card) error
- func (d *Deck) Shuffle()
- func (d Deck) Size() int
- type Face
- type Suit
Constants ¶
View Source
const FullDeckSize = 52
View Source
const ShortDeckSize = 36
Variables ¶
View Source
var DefaultCombinationStrength = []CombinationType{HighCard, Pair, TwoPair, ThreeOfAKind, Straight, Flush, FullHouse, FourOfAKind, StraightFlush}
View Source
var Faces = []Face{Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace}
View Source
var ShortDeckCombinationStrength = []CombinationType{HighCard, Pair, TwoPair, ThreeOfAKind, Straight, FullHouse, Flush, FourOfAKind, StraightFlush}
Functions ¶
This section is empty.
Types ¶
type ByCombination ¶
type ByCombination []Combination
func (ByCombination) Len ¶
func (r ByCombination) Len() int
func (ByCombination) Less ¶
func (r ByCombination) Less(i, j int) bool
func (ByCombination) Swap ¶
func (r ByCombination) Swap(i, j int)
type ByCombinationReversed ¶
type ByCombinationReversed []Combination
func (ByCombinationReversed) Len ¶
func (r ByCombinationReversed) Len() int
func (ByCombinationReversed) Less ¶
func (r ByCombinationReversed) Less(i, j int) bool
func (ByCombinationReversed) Swap ¶
func (r ByCombinationReversed) Swap(i, j int)
type ByFaceReversed ¶
type ByFaceReversed []Card
func (ByFaceReversed) Len ¶
func (r ByFaceReversed) Len() int
func (ByFaceReversed) Less ¶
func (r ByFaceReversed) Less(i, j int) bool
func (ByFaceReversed) Swap ¶
func (r ByFaceReversed) Swap(i, j int)
type Combination ¶
type Combination struct {
// contains filtered or unexported fields
}
func CombinationsOf ¶
func CombinationsOf(cards []Card, combinationStrengths []CombinationType, shortDeck bool) ([]Combination, error)
func NewCombination ¶
func NewCombination(cards []Card, combinationStrengths []CombinationType, shortDeck bool) (*Combination, error)
func NewDefaultCombination ¶
func NewDefaultCombination(cards []Card) (*Combination, error)
func NewShortDeckCombination ¶
func NewShortDeckCombination(cards []Card) (*Combination, error)
func StrongestCombinationOf ¶
func StrongestCombinationOf(cards []Card, combinationStrengths []CombinationType, shortDeck bool) (*Combination, error)
func (Combination) AllCards ¶
func (r Combination) AllCards() []Card
func (Combination) CombinationStrengths ¶
func (r Combination) CombinationStrengths() []CombinationType
func (Combination) HighestCardFace ¶
func (r Combination) HighestCardFace() Face
func (Combination) Kickers ¶
func (r Combination) Kickers() []Card
func (Combination) Less ¶
func (r Combination) Less(other Combination) bool
func (Combination) MainCard ¶
func (r Combination) MainCard() Face
func (Combination) More ¶
func (r Combination) More(other Combination) bool
func (Combination) SecondaryCard ¶
func (r Combination) SecondaryCard() *Face
func (Combination) Tie ¶
func (r Combination) Tie(other Combination) bool
func (Combination) Type ¶
func (r Combination) Type() CombinationType
TODO Known issue: This function will perform ok with short-deck vs classic since the only difference is flush/full house strength since it's impossible to have both at the same time. However, if other custom rules for strength will be passed (as design suggests) there can be issues with the order of combination type resolving. For some reason I couldn't fix it right away, so I will postpone resolving this issue if it will come up some time after
type CombinationType ¶
type CombinationType int
const ( HighCard CombinationType = iota Pair TwoPair ThreeOfAKind Straight Flush FullHouse FourOfAKind StraightFlush )
type Deck ¶
type Deck struct {
// contains filtered or unexported fields
}
func NewFullDeck ¶
func NewFullDeck() Deck
func NewShortDeck ¶
func NewShortDeck() Deck
func (*Deck) CardIsDrawn ¶
func (*Deck) CardIsLeft ¶
func (*Deck) CollectAndShuffle ¶
func (d *Deck) CollectAndShuffle()
func (*Deck) ContainsCard ¶
func (*Deck) MoveToDrawn ¶
Click to show internal directories.
Click to hide internal directories.