Documentation ¶
Overview ¶
Package equity implements functions and structures for calculating the equity of poker hands. The hand evaluation code is based on http://www.codingthewheel.com/archives/poker-hand-evaluator-roundup#2p2
Example hands that can be parsed ********************************* String Combinations Description AJs 4 Any Ace with a Jack of the same suit. 77 6 Any pair of Sevens. T9o 12 Any Ten and Nine of different suits. 54 16 Any Five and Four, suited or unsuited. AJs+ 12 Any Ace with a (Jack through King) of the same suit. 77+ 48 Any pair greater than or equal to Sevens. T9o-65o 12 Any unsuited connector between 65o and T9o. QQ+,AQs+,AK 38 Any pair of Queen or better, any AQs, and any AK whether suited or not. AhKh,7h7d 2 Ace-King of Hearts or a pair of red Sevens.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var NCPU int
How many cpus to use for the equity calculations.
var RANDS []*rand.Rand
Functions ¶
func EvalHands ¶
Calculate the percent of the pot the first player has won.
Example ¶
board := cards.StoI([]string{"4s", "5h", "7d", "8c", "9c"}) hp := cards.StoI([]string{"Ac", "Ad"}) lp := cards.StoI([]string{"2c", "2d"}) fmt.Println(EvalHands(board, hp, lp))
Output: 1
func HandEquity ¶
HandEquity returns the equity of a player's hand based on the current board. trials is the number of Monte-Carlo simulations to do. If trials is 0, then exhaustive enumeration will be used instead.
func HandEquityP ¶
Parallel version of HandEquity.
Types ¶
This section is empty.
Notes ¶
Bugs ¶
The PRNGs are not being used in a way that guarentees their independence and their state space is much smaller than that of a deck of cards.