Documentation
¶
Overview ¶
Index ¶
- Constants
- Variables
- func AllFive(t *testing.T, handfn func() Hand, zerofn func(Hand) Hand)
- func AllSeven(t *testing.T, handfn func() Hand, zerofn func(Hand) Hand)
- func RandomizeHand(h Hand)
- type Card
- type Category
- type Deck
- type FiveCardHand
- func (h *FiveCardHand) Bit() int
- func (h *FiveCardHand) Card(n int) Card
- func (h *FiveCardHand) Cards() []Card
- func (h *FiveCardHand) Eval() Score
- func (h *FiveCardHand) IsSuited() bool
- func (h FiveCardHand) Len() int
- func (h *FiveCardHand) Prime() int
- func (h *FiveCardHand) SetCard(n int, c Card)
- func (h *FiveCardHand) String() string
- type Hand
- type Rank
- type Score
- type SevenCardHand
- func (h *SevenCardHand) Bit() int
- func (h *SevenCardHand) Card(n int) Card
- func (h *SevenCardHand) Cards() []Card
- func (h *SevenCardHand) Eval() Score
- func (h SevenCardHand) Len() int
- func (h *SevenCardHand) Prime() int
- func (h *SevenCardHand) SetCard(n int, c Card)
- func (h *SevenCardHand) String() string
- type Suit
Constants ¶
View Source
const ( Club Suit = 0x8000 Diamond = 0x4000 Heart = 0x2000 Spade = 0x1000 )
Variables ¶
View Source
var Flushes = [...]Score{}/* 7937 elements not displayed */
** this is a table lookup for all "flush" hands (e.g. both ** flushes and straight-flushes. entries containing a zero ** mean that combination is not possible with a five-card ** flush hand.
View Source
var Perm7 = [21][5]int{
{0, 1, 2, 3, 4},
{0, 1, 2, 3, 5},
{0, 1, 2, 3, 6},
{0, 1, 2, 4, 5},
{0, 1, 2, 4, 6},
{0, 1, 2, 5, 6},
{0, 1, 3, 4, 5},
{0, 1, 3, 4, 6},
{0, 1, 3, 5, 6},
{0, 1, 4, 5, 6},
{0, 2, 3, 4, 5},
{0, 2, 3, 4, 6},
{0, 2, 3, 5, 6},
{0, 2, 4, 5, 6},
{0, 3, 4, 5, 6},
{1, 2, 3, 4, 5},
{1, 2, 3, 4, 6},
{1, 2, 3, 5, 6},
{1, 2, 4, 5, 6},
{1, 3, 4, 5, 6},
{2, 3, 4, 5, 6}}
View Source
var Primes = [...]int{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41}
** each of the thirteen card ranks has its own prime number ** ** deuce = 2 ** trey = 3 ** four = 5 ** five = 7 ** ... ** king = 37 ** ace = 41
View Source
var Unique5 = [...]Score{}/* 7937 elements not displayed */
** this is a table lookup for all non-flush hands consisting ** of five unique ranks (i.e. either Straights or High Card ** hands). it's similar to the above "flushes" array.
Functions ¶
func RandomizeHand ¶
func RandomizeHand(h Hand)
Types ¶
type Deck ¶
type Deck []Card
type FiveCardHand ¶
type FiveCardHand struct {
A, B, C, D, E, F Card
}
func NewFiveCardHand ¶
func NewFiveCardHand() *FiveCardHand
func (*FiveCardHand) Bit ¶
func (h *FiveCardHand) Bit() int
func (*FiveCardHand) Card ¶
func (h *FiveCardHand) Card(n int) Card
func (*FiveCardHand) Cards ¶
func (h *FiveCardHand) Cards() []Card
func (*FiveCardHand) Eval ¶
func (h *FiveCardHand) Eval() Score
func (*FiveCardHand) IsSuited ¶
func (h *FiveCardHand) IsSuited() bool
IsSuited returns true if entire hand is of the same Suit.
func (FiveCardHand) Len ¶
func (h FiveCardHand) Len() int
func (*FiveCardHand) Prime ¶
func (h *FiveCardHand) Prime() int
func (*FiveCardHand) SetCard ¶
func (h *FiveCardHand) SetCard(n int, c Card)
func (*FiveCardHand) String ¶
func (h *FiveCardHand) String() string
type Hand ¶
type Hand interface { Eval() Score SetCard(int, Card) Card(int) Card Len() int Cards() []Card Prime() int Bit() int }
func RandomHand ¶
type SevenCardHand ¶
type SevenCardHand struct{ A, B, C, D, E, F, G Card }
func NewSevenCardHand ¶
func NewSevenCardHand() *SevenCardHand
func (*SevenCardHand) Bit ¶
func (h *SevenCardHand) Bit() int
func (*SevenCardHand) Card ¶
func (h *SevenCardHand) Card(n int) Card
func (*SevenCardHand) Cards ¶
func (h *SevenCardHand) Cards() []Card
func (*SevenCardHand) Eval ¶
func (h *SevenCardHand) Eval() Score
func (SevenCardHand) Len ¶
func (h SevenCardHand) Len() int
func (*SevenCardHand) Prime ¶
func (h *SevenCardHand) Prime() int
func (*SevenCardHand) SetCard ¶
func (h *SevenCardHand) SetCard(n int, c Card)
func (*SevenCardHand) String ¶
func (h *SevenCardHand) String() string
Click to show internal directories.
Click to hide internal directories.