|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.asdf.plugins.pokergames.HandEval
public class HandEval
This class evaluates poker hands with methods eval_5cards and eval_7cards. Returns an integer representing the "strength" of a hand. A hand with greater number wins against lower value hands.
| Field Summary | |
|---|---|
int |
FLUSH
|
int |
FOUR_OF_A_KIND
|
int |
FULL_HOUSE
|
int |
HIGH_CARD
|
int |
ONE_PAIR
|
int |
STRAIGHT
|
int |
STRAIGHT_FLUSH
|
EvalTables |
tables
|
int |
THREE_OF_A_KIND
|
int |
TWO_PAIR
|
static java.lang.String[] |
value_str
|
| Constructor Summary | |
|---|---|
HandEval(EvalTables evalTables)
Constructor. |
|
| Method Summary | |
|---|---|
int |
eval_5cards(int c1,
int c2,
int c3,
int c4,
int c5)
Calculates the absolute value of a given 5 card poker-hand. |
BestHand |
eval_6cards(int[] cards)
Cycles through all 5 card combinations of the 6 cards, and returns the best hand and it's value. |
BestHand |
eval_7cards(int[] cards)
Cycles through all 5 card combinations of the 7 cards, and returns the best hand and it's value. |
int |
find_card(int rank,
int suit,
java.util.Vector<java.lang.Integer> deck)
This routine will search a deck for a specific card (specified by rank/suit), and return the INDEX giving the position of the found card. |
int |
findit(int key)
This function performs a binary search on a presorted array of integer representasions of hands. |
int |
hand_rank(int val)
Obtains the hand type of a hand, given it's value. |
void |
init_deck(java.util.Vector<java.lang.Integer> deck)
Describes how a deck should be built if this evaluator is intended to be used with the deck. |
int |
RANK(int x)
Getter for card rank for a card in integer representation. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public EvalTables tables
public final int STRAIGHT_FLUSH
public final int FOUR_OF_A_KIND
public final int FULL_HOUSE
public final int FLUSH
public final int STRAIGHT
public final int THREE_OF_A_KIND
public final int TWO_PAIR
public final int ONE_PAIR
public final int HIGH_CARD
public static java.lang.String[] value_str
| Constructor Detail |
|---|
public HandEval(EvalTables evalTables)
evalTables - Reference to an EvalTables instance.| Method Detail |
|---|
public void init_deck(java.util.Vector<java.lang.Integer> deck)
deck - A Vector of Integer representations of Cards.public int findit(int key)
key - Prime number representation of the given hand.
public int find_card(int rank,
int suit,
java.util.Vector<java.lang.Integer> deck)
rank - Rank of queried card.suit - Suit of queried card. (0x8000 || 0x4000 || 0x2000 || 0x1000)deck - A deck of cards.
public BestHand eval_6cards(int[] cards)
cards - A 6 card hand in integer representation. See com.asdf.utils.Card.getInt().
public BestHand eval_7cards(int[] cards)
cards - A 7 card hand in integer representation. See com.asdf.utils.Card.getInt().
public int eval_5cards(int c1,
int c2,
int c3,
int c4,
int c5)
c1 - card1c2 - card2c3 - card3c4 - card4c5 - card5
public int hand_rank(int val)
val - Value of a poker hand.
public int RANK(int x)
x - a card.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||