|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectglassfrog.handevaluator.HandEvaluator
public class HandEvaluator
Class for identifying / comparing / ranking Hands.
Field Summary | |
---|---|
static int |
FIVEKIND
|
private static int |
flush
|
static int |
FLUSH
|
static int |
FOURKIND
|
private static int |
fullhouse
|
static int |
FULLHOUSE
|
private static java.lang.String[] |
hand_name
|
static int |
HIGH
|
private static int |
highcard
|
private static int |
ID_GROUP_SIZE
|
private static int |
nopair
|
static int |
NUM_HANDS
|
private static int |
NUM_RANKS
|
private static int |
pair
|
static int |
PAIR
|
private static int |
POKER_HAND
|
private static int |
quads
|
private static java.lang.String[] |
rank_name
|
private static int |
straight
|
static int |
STRAIGHT
|
static int |
STRAIGHTFLUSH
|
private static int |
strflush
|
static int |
THREEKIND
|
private static int |
trips
|
private static int |
twopair
|
static int |
TWOPAIR
|
private static int |
unknown
|
Constructor Summary | |
---|---|
HandEvaluator()
|
Method Summary | |
---|---|
private int |
Best_Hand(int[] hand1,
int[] hand2)
|
private static boolean |
Check_StrFlush(int[] hand,
int[] dist,
int[] best)
|
int |
compareHands(EvaluateHand h1,
EvaluateHand h2)
Compares two hands against each other. |
int |
compareHands(int rank1,
EvaluateHand h2)
Compares two 5-7 card hands against each other. |
private java.lang.String |
drb_Name_Hand(int handtype)
Get a string from a hand type. |
private void |
Find_Flush(int[] hand,
int[] dist,
int[] best)
|
private void |
Find_FullHouse(int[] hand,
int[] dist,
int[] best)
|
private int |
Find_Hand(int[] hand,
int[] best)
|
private void |
Find_NoPair(int[] hand,
int[] dist,
int[] best)
|
private void |
Find_Pair(int[] hand,
int[] dist,
int[] best)
|
private void |
Find_Quads(int[] hand,
int[] dist,
int[] best)
|
private void |
Find_Straight(int[] hand,
int[] dist,
int[] best)
|
private void |
Find_Trips(int[] hand,
int[] dist,
int[] best)
|
private void |
Find_TwoPair(int[] hand,
int[] dist,
int[] best)
|
EvaluateHand |
getBest5CardHand(EvaluateHand h)
Get the best 5 card poker hand from a 7 card hand |
int[][] |
getRanks(EvaluateHand board)
Given a board, cache all possible two card combinations of hand ranks, so that lightenting fast hand comparisons may be done later. |
private static byte |
ID_ExistsStraightFlush(EvaluateHand h,
byte major_suit)
|
private static int |
ID_KickerValue(byte[] paired,
int kickers,
byte[] not_allowed)
|
private static int |
ID_KickerValueSuited(EvaluateHand h,
int kickers,
byte suit)
|
static void |
main(java.lang.String[] args)
|
private static java.lang.String |
name_hand(int rank)
Return a string naming the hand |
static java.lang.String |
nameHand(EvaluateHand h)
Given a hand, return a string naming the hand ('Ace High Flush', etc..) |
private static int |
pow(int n,
int p)
|
int |
rankHand(EvaluateCard c1,
EvaluateCard c2,
EvaluateHand h)
Get a numerical ranking of this hand. |
static int |
rankHand(EvaluateHand h)
Get a numerical ranking of this hand. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int unknown
private static final int strflush
private static final int quads
private static final int fullhouse
private static final int flush
private static final int straight
private static final int trips
private static final int twopair
private static final int pair
private static final int nopair
private static final int highcard
private static final int POKER_HAND
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
private static final int NUM_RANKS
private static final int ID_GROUP_SIZE
private static final java.lang.String[] hand_name
private static final java.lang.String[] rank_name
Constructor Detail |
---|
public HandEvaluator()
Method Detail |
---|
public static void main(java.lang.String[] args)
public int rankHand(EvaluateCard c1, EvaluateCard c2, EvaluateHand h)
c1
- first hole cardc2
- second hole cardh
- a 3-5 card hand
public static java.lang.String nameHand(EvaluateHand h)
public int compareHands(EvaluateHand h1, EvaluateHand h2)
h1
- The first handh2
- The second hand
public int compareHands(int rank1, EvaluateHand h2)
rank1
- The rank of the first handh2
- The second hand
public int[][] getRanks(EvaluateHand board)
public EvaluateHand getBest5CardHand(EvaluateHand h)
h
- Any 7 card poker hand
private java.lang.String drb_Name_Hand(int handtype)
handtype
- number coding a hand type
private static boolean Check_StrFlush(int[] hand, int[] dist, int[] best)
private void Find_Quads(int[] hand, int[] dist, int[] best)
private void Find_FullHouse(int[] hand, int[] dist, int[] best)
private void Find_Flush(int[] hand, int[] dist, int[] best)
private void Find_Straight(int[] hand, int[] dist, int[] best)
private void Find_Trips(int[] hand, int[] dist, int[] best)
private void Find_TwoPair(int[] hand, int[] dist, int[] best)
private void Find_Pair(int[] hand, int[] dist, int[] best)
private void Find_NoPair(int[] hand, int[] dist, int[] best)
private int Best_Hand(int[] hand1, int[] hand2)
private int Find_Hand(int[] hand, int[] best)
private static final byte ID_ExistsStraightFlush(EvaluateHand h, byte major_suit)
private static final int ID_KickerValue(byte[] paired, int kickers, byte[] not_allowed)
private static final int ID_KickerValueSuited(EvaluateHand h, int kickers, byte suit)
public static final int rankHand(EvaluateHand h)
h
- a 1-9 card hand
private static int pow(int n, int p)
private static java.lang.String name_hand(int rank)
rank
- calculated by rankHand_java()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |