hand

package
v0.0.0-...-f4aeec7 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2016 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// H1Win constant
	H1Win = OUTCOME(iota)
	// H2Win constant
	H2Win = OUTCOME(iota)
	// Draw constant
	Draw = OUTCOME(iota)
)
View Source
const (
	// HighCard constant
	HighCard = RANK(iota)
	// OnePair constant
	OnePair = RANK(iota)
	// TwoPair constant
	TwoPair = RANK(iota)
	// ThreeOfAKind constant
	ThreeOfAKind = RANK(iota)
	// Straight constant
	Straight = RANK(iota)
	// Flush constant
	Flush = RANK(iota)
	// FullHouse constant
	FullHouse = RANK(iota)
	// FourOfAKind constant
	FourOfAKind = RANK(iota)
	// StraightFlush constant
	StraightFlush = RANK(iota)
	// RoyalFlush constant
	RoyalFlush = RANK(iota)
)

Variables

This section is empty.

Functions

func Showdown

func Showdown(hands []Hand) []int

Showdown determines the winner of two to many hands It multiplexes hand comparison (which is a binary operation) over many hands. It returns a slice of the winning index/ drawing indexes

func ToHandType

func ToHandType(h Hand) string

ToHandType where a hand type is a string of format AKs AA 89o

Types

type Hand

type Hand []*card.Card

Hand represents a collection of cards

func Remove

func Remove(h Hand, c *card.Card) Hand

Remove removes a card from the given hand

func (Hand) Len

func (h Hand) Len() int

func (Hand) Less

func (h Hand) Less(i, j int) bool

func (Hand) Swap

func (h Hand) Swap(i, j int)

type OUTCOME

type OUTCOME int

OUTCOME type represents all the possible outcomes of a hand

type RANK

type RANK int

RANK type represents the hierarchy of winning hands

type Value

type Value struct {
	Rank RANK
	Hand Hand
}

Value encapsulates a showdown hand and is used to compare showdown hands. Kicker may be default value, not all hands have kickers. Value contains tie breaking logic.

func FormHand

func FormHand(h Hand) (*Value, error)

FormHand given the hole cards and community cards returns the best Value that can be formed

func NewHandValue

func NewHandValue(rank RANK, hand Hand) *Value

NewHandValue creates a new Value

func (Value) String

func (v Value) String() string

Jump to

Keyboard shortcuts

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