Interface Strategy


public interface Strategy

Defines the essential method for a Video Poker Strategy.

Strategy assumes canonical representations for hands and associated keepers.
The canonical representation of a hand is as the least-significant (rightmost) 30 bits of a 32-bit int value, defined as follows:

Each card in the hand is represented by 6 bits computed as
( rank * 4 ) + suit
(The magic number "4" corresponds to the number of suits.)

rank is in the range [0 .. 12] where 0 == Deuce, 1 == Trey, ..., 11 == King and 12 == Ace.
suit is in the range [0 .. 3] where 0 == Clubs, 1 == Diamonds, 2 == Hearts, and 3 == Spades.

Cards in the canonical representation of a hand are sorted in ascending order according to their encoded value, which results in a rank-major/suit-minor ordering.

The rightmost 6 bits of the canonical hand representation represent the highest valued card in the hand. The next significant 6 bits represent the next card, and so on.

The canonical representation of associated keepers is as the least-significant 5 bits of an 8-bit byte value, where 1 indicates that the card in that position of the canonical representation of the hand should be kept and 0 indicates that the card should not be kept.


Method Summary
 byte keepers(int hand)
          Return the byte representation of keepers for a given hand.
 

Method Detail

keepers

byte keepers(int hand)
Return the byte representation of keepers for a given hand.

Parameters:
hand - the canonical representation of a hand
Returns:
the canonical representation of keepers for the hand