Documentation ¶
Overview ¶
Package poker provides functions for poker tools.
Index ¶
Constants ¶
const ( Club = Suit(0) Diamond = Suit(1) Heart = Suit(2) Spade = Suit(3) BadSuit = Suit(255) )
const ScoreMax = 7929
ScoreMax is the largest possible result from Eval (with replace=true).
Variables ¶
var Cards []Card
Cards is a full deck of all cards. Sorted by suit and then rank.
var NameToCard = map[string]Card{}
NameToCard maps card names (for example, "C8" or "HA") to a card value.
Functions ¶
func DescribeShort ¶
Describe describes a 3, 5 or 7 card poker hand with enough detail to compare it to another poker hand which shares no cards in common. For example, KKK-87 is represented as KKK-x-y since the kickers can never matter (except that they are different).
func Eval ¶
Eval takes a 3- or 5- card poker hand and returns a number which can be used to rank it against other poker hands. The returned value is in the range 0 to ScoreMax.
Types ¶
type Card ¶
type Card uint16
A Card is a single playing card. The top two bits are the suit, and the lowest 6 bits store the (r-1)th prime number. This representation enables fast hand evaluation. Heavily based on the ideas from Cactus Pete's poker hand evaluator, which can be found here: See http://www.suffecool.net/poker/evaluator.html
func EvalToHand3 ¶
EvalToHand3 returns an example 3-card hand with the given eval score. The second return value is whether the result is valid.
func EvalToHand5 ¶
EvalToHand5 returns an example 5-card hand with the given eval score. The second return value is whether the result is valid.
func (Card) RawRank ¶
RawRank returns a number from 0 to 12 representing the strength of the card. 2->0, 3->1, ..., K->11, A->12.
type Equity ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
holdemeval
Binary holdemeval computes exact holdem hand equities for a given set of hands.
|
Binary holdemeval computes exact holdem hand equities for a given set of hands. |