java.lang.Object
cz.matfyz.rudad.joker.evaluator.Evaluator
The Evaluator class provides methods for evaluating poker hands with 7 cards.
It uses a combination of hash tables and lookup tables for efficient evaluation.
Source: evaluator7.c
-
Method Summary
Modifier and TypeMethodDescriptionstatic short
evaluate7Cards
(int a, int b, int c, int d, int e, int f, int g) Evaluates the strength of a poker hand with 7 cards given their card IDs.static short
Evaluates the strength of a poker hand with 7 cards given as individual Card objects.static short
Evaluates the strength of a poker hand with 7 cards specified as string aliases.static short
evaluate7Cards
(List<Card> hand) Evaluates the strength of a poker hand with 7 cards given as a list of Card objects.static boolean
isFirstHandWinning
(short handValue1, short handValue2) Determines if the first poker hand is winning against the second poker hand.static boolean
isSecondHandWinning
(short handValue1, short handValue2) Determines if the second poker hand is winning against the first poker hand.static boolean
isTied
(short handValue1, short handValue2) Determines if two poker hands are tied.
-
Method Details
-
isTied
public static boolean isTied(short handValue1, short handValue2) Determines if two poker hands are tied.- Parameters:
handValue1
- the value of the first handhandValue2
- the value of the second hand- Returns:
true
if the hands are tied,false
otherwise
-
isFirstHandWinning
public static boolean isFirstHandWinning(short handValue1, short handValue2) Determines if the first poker hand is winning against the second poker hand. Lower value means stronger hand.- Parameters:
handValue1
- the value of the first handhandValue2
- the value of the second hand- Returns:
true
if the first hand is winning,false
otherwise
-
isSecondHandWinning
public static boolean isSecondHandWinning(short handValue1, short handValue2) Determines if the second poker hand is winning against the first poker hand. Lower value means stronger hand.- Parameters:
handValue1
- the value of the first handhandValue2
- the value of the second hand- Returns:
true
if the second hand is winning,false
otherwise
-
evaluate7Cards
public static short evaluate7Cards(String a, String b, String c, String d, String e, String f, String g) Evaluates the strength of a poker hand with 7 cards specified as string aliases.- Parameters:
a
- the first card aliasb
- the second card aliasc
- the third card aliasd
- the fourth card aliase
- the fifth card aliasf
- the sixth card aliasg
- the seventh card alias- Returns:
- the evaluation result as a short value
-
evaluate7Cards
Evaluates the strength of a poker hand with 7 cards given as a list of Card objects.- Parameters:
hand
- the list of 7 Card objects representing the hand- Returns:
- the evaluation result as a short value
- Throws:
AssertionError
- if the hand does not contain exactly 7 cards
-
evaluate7Cards
Evaluates the strength of a poker hand with 7 cards given as individual Card objects.- Parameters:
a
- the first cardb
- the second cardc
- the third cardd
- the fourth carde
- the fifth cardf
- the sixth cardg
- the seventh card- Returns:
- the evaluation result as a short value
-
evaluate7Cards
public static short evaluate7Cards(int a, int b, int c, int d, int e, int f, int g) Evaluates the strength of a poker hand with 7 cards given their card IDs.Card IDs are integers ranged from 0-51. The two least significant bits represent the suit, ranged from 0-3. The rest of it represent the rank, ranged from 0-12. 13 * 4 gives 52 IDs. Source: evaluator7.c
- Parameters:
a
- the card ID of the first cardb
- the card ID of the second cardc
- the card ID of the third cardd
- the card ID of the fourth carde
- the card ID of the fifth cardf
- the card ID of the sixth cardg
- the card ID of the seventh card- Returns:
- the evaluation result as a short value
-