hand

package
v0.0.0-...-b7ca9ae Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hand

type Hand interface {
	// Returns the best possible HandRank given a hand & table combination
	BestHand() (*HandRank, error)
}

A hand consists of a number of hole cards and a number of board cards.

type HandRank

type HandRank struct {
	// The type of the hand rank
	RankType RankType

	// A list of the ranks of the cards in the hands, in sorted order
	// of importance
	//
	// Only important ranks will be given. For example, straights will
	// only have the highest card, and quads will only give the quaded
	// card and the kicker.
	Ranks []card.Rank
}

func RankHand

func RankHand(cards []card.Card) (*HandRank, error)

Given a hand of cards, get the rank of the hand

func (*HandRank) Compare

func (r *HandRank) Compare(other *HandRank) int

Returns -1 if the first hand is worse; 1 if better; 0 if tied.

type RankType

type RankType int
const (
	Invalid RankType = iota
	HighCard
	Pair
	TwoPair
	Triple
	Straight
	Flush
	FullHouse
	Quad
	StraightFlush
)

type SimpleHandImpl

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

A rudimentary way of calculating the best hand on the board

func NewSimpleHandEvaluator

func NewSimpleHandEvaluator(hole []card.Card, community []card.Card) *SimpleHandImpl

Creates a new simple hand evaluator

func (*SimpleHandImpl) BestHand

func (h *SimpleHandImpl) BestHand() (*HandRank, error)

Jump to

Keyboard shortcuts

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