|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpoker.HandEvaluator
public class HandEvaluator
Class for identifying / comparing / ranking Hands.
Source Code: HandEvaluator.java
JNI Poker Evaluation Library Code
Field Summary | |
---|---|
static int |
FIVEKIND
|
static int |
FLUSH
|
static int |
FOURKIND
|
static int |
FULLHOUSE
|
static int |
HIGH
|
static int |
NUM_HANDS
|
static int |
PAIR
|
static int |
STRAIGHT
|
static int |
STRAIGHTFLUSH
|
static int |
THREEKIND
|
static int |
TWOPAIR
|
Constructor Summary | |
---|---|
HandEvaluator()
Construct a new Hand Evaluator. |
Method Summary | |
---|---|
static void |
CGetRanks(int[] board,
int[] ranks)
|
static double |
CHandRank(int c1,
int c2,
int[] board)
Calculates the probability of having the best hand against one opponent. |
static int |
compareHands(Hand h1,
Hand h2)
Compares two 7 card hands against each other. |
static int |
compareHands(int rank1,
Hand h2)
Compares two 5-7 card hands against each other. |
static int |
CRankHandFast(int[] cards)
Get a numerical ranking of this hand. |
static int |
CRankHandFast7(int[] cards)
Get a numerical ranking of this hand. |
static int |
Find_Hand(int[] hand,
int[] best)
|
static Hand |
getBest5CardHand(Hand h)
Get the best 5 card poker hand from a 7 card hand |
static int |
getCardThatPlays(int rank1,
int rank2)
Return the Card that plays between the two given hands ranks. |
static int |
getHandClass(Hand h)
Get the class of hand (PAIR, STRAIGHT) |
int |
getNumBetter()
Get the number of hands better than the last hand ranked. |
static int |
getNumCardsPlayed(int rank1,
int rank2)
Return the number of Cards that play between the two given hands ranks. |
int |
getNumTied()
Get the number of hands tied with the last hand ranked. |
int |
getNumWorse()
Get the number of hands worse than the last hand ranked. |
static NChoose2IntTable |
getRanks(Hand board)
Given a board, cache all possible two card combinations of hand ranks, so that lightenting fast hand comparisons may be done later. |
static NChoose2IntTable |
getRanksNative(Hand board)
|
double |
handRank(Card c1,
Card c2,
Hand h)
Calculates the probability of having the best hand against one opponent. |
double |
handRank(Card c1,
Card c2,
Hand h,
int np)
Calculates the probability of having the best hand against several opponents. |
static double |
handRank(Card c1,
Card c2,
NChoose2IntTable rankCache,
Deck dk)
Calculate the strength of the given hand. |
static double |
handRankNative(Card c1,
Card c2,
Hand h)
|
boolean |
isNative()
Returns true if the native evaluation library is loaded. |
static boolean |
isTheNuts(Card c1,
Card c2,
Hand board,
NChoose2IntTable rankCache)
Determine if the hand is the nuts (no hands beat it) |
static java.lang.String |
name_hand(int rank,
int num_cards)
Return a string naming the hand with the number of kickers that play |
static java.lang.String |
name_hand1(int rank,
int card)
Return a string representing the name of the hand with the proper kicker information |
static java.lang.String |
nameHand(Card c1,
Card c2,
Hand b)
Given a hand, return a string naming the hand ('Ace High Flush', etc..) |
static java.lang.String |
nameHand(Hand h)
Given a hand, return a string naming the hand ('Ace High Flush', etc..) |
static double[] |
potential(Card c1,
Card c2,
Hand bd,
com.biotools.poker.model.WeightTable wt)
|
static double |
ppot1(Card c1,
Card c2,
Hand bd,
com.biotools.poker.model.WeightTable wt)
|
static double |
ppot1(int c1,
int c2,
int[] bd,
double[] weights,
double[] result)
|
static int |
rankHand_Java(Hand h)
Get a numerical ranking of this hand. |
static int |
rankHand(Card c1,
Card c2,
Hand h)
Get a numerical ranking of this hand. |
static int |
rankHand(Hand h)
Get a numerical ranking of this hand. |
static int |
rankHand7(Hand h)
Get a numerical ranking of this hand. |
static void |
test()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HIGH
public static final int PAIR
public static final int TWOPAIR
public static final int THREEKIND
public static final int STRAIGHT
public static final int FLUSH
public static final int FULLHOUSE
public static final int FOURKIND
public static final int STRAIGHTFLUSH
public static final int FIVEKIND
public static final int NUM_HANDS
Constructor Detail |
---|
public HandEvaluator()
Method Detail |
---|
public boolean isNative()
public static final int rankHand(Hand h)
h
- a 5-7 card hand
public static int rankHand(Card c1, Card c2, Hand h)
c1
- first hole cardc2
- second hole cardh
- a 3-5 card hand
public static java.lang.String nameHand(Card c1, Card c2, Hand b)
public static java.lang.String nameHand(Hand h)
public static int compareHands(Hand h1, Hand h2)
h1
- The first handh2
- The second hand
public static int compareHands(int rank1, Hand h2)
rank1
- The rank of the first handh2
- The second hand
public static int CRankHandFast(int[] cards)
cards
- an array of up to 7 card integers
public static int CRankHandFast7(int[] cards)
cards
- an array of 7 card integers
public static double CHandRank(int c1, int c2, int[] board)
c1
- hole card 1c2
- hole card 2board
- the board
public static double handRankNative(Card c1, Card c2, Hand h)
public static final int rankHand7(Hand h)
h
- a 7 card hand
public static void CGetRanks(int[] board, int[] ranks)
public static NChoose2IntTable getRanksNative(Hand board)
public static NChoose2IntTable getRanks(Hand board)
public double handRank(Card c1, Card c2, Hand h, int np)
c1
- hole card 1c2
- hole card 2h
- the boardnp
- the number of active opponents in the hand
public double handRank(Card c1, Card c2, Hand h)
c1
- hole card 1c2
- hole card 2h
- the board
public static double handRank(Card c1, Card c2, NChoose2IntTable rankCache, Deck dk)
c1
- the first hole cardc2
- the second hole cardrankCache
- the ranks for all hands against a board where rankCache[i][j] =
the rank of Card(i) and Card(j) the array stores the same values
both in [i][j] and [j][i] for faster access times. (this cache
can be obtained from HandEvaluator.getRanks(Hand))dk
- the deck with all known cards removed
public int getNumWorse()
public int getNumBetter()
public int getNumTied()
public static final boolean isTheNuts(Card c1, Card c2, Hand board, NChoose2IntTable rankCache)
public static Hand getBest5CardHand(Hand h)
h
- Any 7 card poker hand
public static int Find_Hand(int[] hand, int[] best)
public static final int rankHand_Java(Hand h)
h
- a 1-9 card hand
public static int getHandClass(Hand h)
public static double ppot1(int c1, int c2, int[] bd, double[] weights, double[] result)
public static double ppot1(Card c1, Card c2, Hand bd, com.biotools.poker.model.WeightTable wt)
public static double[] potential(Card c1, Card c2, Hand bd, com.biotools.poker.model.WeightTable wt)
public static void test()
public static java.lang.String name_hand(int rank, int num_cards)
rank
- calculated by rankHand_java()num_kickers
- is the number of kickers (cards) that play between the two hands
public static int getNumCardsPlayed(int rank1, int rank2)
rank1
- is the first players hand rank calculated by rankHand_java()rank2
- is the second players hand rank calculated by rankHand_java()
public static int getCardThatPlays(int rank1, int rank2)
rank1
- is the first players hand rank calculated by rankHand_java()rank2
- is the second players hand rank calculated by rankHand_java()
public static java.lang.String name_hand1(int rank, int card)
rank
- calculated by rankHand_java()card
- is the array position of the card used to break the tie.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |