Class Evaluator

java.lang.Object
cz.matfyz.rudad.joker.evaluator.Evaluator

public final class Evaluator extends Object
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 Type
    Method
    Description
    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.
    static short
    evaluate7Cards(Card a, Card b, Card c, Card d, Card e, Card f, Card g)
    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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 hand
      handValue2 - 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 hand
      handValue2 - 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 hand
      handValue2 - 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 alias
      b - the second card alias
      c - the third card alias
      d - the fourth card alias
      e - the fifth card alias
      f - the sixth card alias
      g - the seventh card alias
      Returns:
      the evaluation result as a short value
    • evaluate7Cards

      public static short evaluate7Cards(List<Card> hand)
      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

      public static short evaluate7Cards(Card a, Card b, Card c, Card d, Card e, Card f, Card g)
      Evaluates the strength of a poker hand with 7 cards given as individual Card objects.
      Parameters:
      a - the first card
      b - the second card
      c - the third card
      d - the fourth card
      e - the fifth card
      f - the sixth card
      g - 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 card
      b - the card ID of the second card
      c - the card ID of the third card
      d - the card ID of the fourth card
      e - the card ID of the fifth card
      f - the card ID of the sixth card
      g - the card ID of the seventh card
      Returns:
      the evaluation result as a short value