PokerHand

Represents a poker hand.

Methods

make_histograms

Computes histograms for suits and hands. Creates attributes: suits: a histogram of the suits in the hand. ranks: a histogram of the ranks. sets: a sorted list of the rank sets in the hand.

Parameters

namedescriptiondefault

self

has_highcard

Returns True if this hand has a high card.

Parameters

namedescriptiondefault

self

check_sets

Checks whether self.sets contains sets that are at least as big as the requirements in t. t: list of int

Parameters

namedescriptiondefault

self

has_pair

Checks whether this hand has a pair.

Parameters

namedescriptiondefault

self

has_twopair

Checks whether this hand has two pair.

Parameters

namedescriptiondefault

self

has_threekind

Checks whether this hand has three of a kind.

Parameters

namedescriptiondefault

self

has_fourkind

Checks whether this hand has four of a kind.

Parameters

namedescriptiondefault

self

has_fullhouse

Checks whether this hand has a full house.

Parameters

namedescriptiondefault

self

has_flush

Checks whether this hand has a flush.

Parameters

namedescriptiondefault

self

has_straight

Checks whether this hand has a straight.

Parameters

namedescriptiondefault

self

in_a_row

Checks whether the histogram has n ranks in a row. hist: map from rank to frequency n: number we need to get to

Parameters

namedescriptiondefault

self

ranks

n

5

has_straightflush

Checks whether this hand has a straight flush. Clumsy algorithm.

Parameters

namedescriptiondefault

self

has_straightflush

Checks whether this hand has a straight flush. Better algorithm (in the sense of being more demonstrably correct).

Parameters

namedescriptiondefault

self

classify

Classifies this hand. Creates attributes: labels:

Parameters

namedescriptiondefault

self

Last updated