wyvern.lib.classes.games.card
Class HandType

java.lang.Object
  extended bywyvern.lib.classes.games.card.HandType

public class HandType
extends java.lang.Object

Represents the "good" hands you can get: 2 pair, 3 of a kind, full house, etc. Typesafe enum, but subclassable so you can add your own good hands (or scoring system).

Version:
1.0, Oct 02, 2003
Author:
Steve Yegge

Field Summary
static HandType FLUSH
           
static double FLUSH_CHANCE
           
static int FLUSH_HANDS
           
static int FLUSH_SCORE
           
static HandType FOUR_OF_A_KIND
           
static double FOUR_OF_A_KIND_CHANCE
           
static int FOUR_OF_A_KIND_HANDS
           
static int FOUR_OF_A_KIND_SCORE
           
static HandType FULL_HOUSE
           
static double FULL_HOUSE_CHANCE
           
static int FULL_HOUSE_HANDS
           
static int FULL_HOUSE_SCORE
           
static HandType NOTHING
           
static double NOTHING_CHANCE
           
static int NOTHING_HANDS
           
static int NOTHING_SCORE
           
static HandType ONE_PAIR
           
static double ONE_PAIR_CHANCE
           
static int ONE_PAIR_HANDS
           
static int ONE_PAIR_SCORE
           
static HandType ROYAL_FLUSH
           
static double ROYAL_FLUSH_CHANCE
           
static int ROYAL_FLUSH_HANDS
           
static int ROYAL_FLUSH_SCORE
           
static HandType STRAIGHT
           
static double STRAIGHT_CHANCE
           
static HandType STRAIGHT_FLUSH
           
static double STRAIGHT_FLUSH_CHANCE
           
static int STRAIGHT_FLUSH_HANDS
           
static int STRAIGHT_FLUSH_SCORE
           
static int STRAIGHT_HANDS
           
static int STRAIGHT_SCORE
           
static HandType THREE_OF_A_KIND
           
static double THREE_OF_A_KIND_CHANCE
           
static int THREE_OF_A_KIND_HANDS
           
static int THREE_OF_A_KIND_SCORE
           
static int TOTAL_HANDS
           
static HandType TWO_PAIR
           
static double TWO_PAIR_CHANCE
           
static int TWO_PAIR_HANDS
           
static int TWO_PAIR_SCORE
           
 
Constructor Summary
HandType(java.lang.String name, int score)
          Constructs a new HandType
 
Method Summary
 boolean beats(HandType h)
          Returns true if this hand beats another hand.
 java.lang.String getName()
          Returns name of the hand.
 int getScore()
          Returns an arbitrary score for this hand.
 java.lang.String toString()
          Returns name of the hand.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOTAL_HANDS

public static final int TOTAL_HANDS
See Also:
Constant Field Values

NOTHING_HANDS

public static final int NOTHING_HANDS
See Also:
Constant Field Values

NOTHING_CHANCE

public static final double NOTHING_CHANCE
See Also:
Constant Field Values

NOTHING_SCORE

public static final int NOTHING_SCORE
See Also:
Constant Field Values

ONE_PAIR_HANDS

public static final int ONE_PAIR_HANDS
See Also:
Constant Field Values

ONE_PAIR_CHANCE

public static final double ONE_PAIR_CHANCE
See Also:
Constant Field Values

ONE_PAIR_SCORE

public static final int ONE_PAIR_SCORE
See Also:
Constant Field Values

TWO_PAIR_HANDS

public static final int TWO_PAIR_HANDS
See Also:
Constant Field Values

TWO_PAIR_CHANCE

public static final double TWO_PAIR_CHANCE
See Also:
Constant Field Values

TWO_PAIR_SCORE

public static final int TWO_PAIR_SCORE
See Also:
Constant Field Values

THREE_OF_A_KIND_HANDS

public static final int THREE_OF_A_KIND_HANDS
See Also:
Constant Field Values

THREE_OF_A_KIND_CHANCE

public static final double THREE_OF_A_KIND_CHANCE
See Also:
Constant Field Values

THREE_OF_A_KIND_SCORE

public static final int THREE_OF_A_KIND_SCORE
See Also:
Constant Field Values

STRAIGHT_HANDS

public static final int STRAIGHT_HANDS
See Also:
Constant Field Values

STRAIGHT_CHANCE

public static final double STRAIGHT_CHANCE
See Also:
Constant Field Values

STRAIGHT_SCORE

public static final int STRAIGHT_SCORE
See Also:
Constant Field Values

FLUSH_HANDS

public static final int FLUSH_HANDS
See Also:
Constant Field Values

FLUSH_CHANCE

public static final double FLUSH_CHANCE
See Also:
Constant Field Values

FLUSH_SCORE

public static final int FLUSH_SCORE
See Also:
Constant Field Values

FULL_HOUSE_HANDS

public static final int FULL_HOUSE_HANDS
See Also:
Constant Field Values

FULL_HOUSE_CHANCE

public static final double FULL_HOUSE_CHANCE
See Also:
Constant Field Values

FULL_HOUSE_SCORE

public static final int FULL_HOUSE_SCORE
See Also:
Constant Field Values

FOUR_OF_A_KIND_HANDS

public static final int FOUR_OF_A_KIND_HANDS
See Also:
Constant Field Values

FOUR_OF_A_KIND_CHANCE

public static final double FOUR_OF_A_KIND_CHANCE
See Also:
Constant Field Values

FOUR_OF_A_KIND_SCORE

public static final int FOUR_OF_A_KIND_SCORE
See Also:
Constant Field Values

STRAIGHT_FLUSH_HANDS

public static final int STRAIGHT_FLUSH_HANDS
See Also:
Constant Field Values

STRAIGHT_FLUSH_CHANCE

public static final double STRAIGHT_FLUSH_CHANCE
See Also:
Constant Field Values

STRAIGHT_FLUSH_SCORE

public static final int STRAIGHT_FLUSH_SCORE
See Also:
Constant Field Values

ROYAL_FLUSH_HANDS

public static final int ROYAL_FLUSH_HANDS
See Also:
Constant Field Values

ROYAL_FLUSH_CHANCE

public static final double ROYAL_FLUSH_CHANCE
See Also:
Constant Field Values

ROYAL_FLUSH_SCORE

public static final int ROYAL_FLUSH_SCORE
See Also:
Constant Field Values

NOTHING

public static final HandType NOTHING

ONE_PAIR

public static final HandType ONE_PAIR

TWO_PAIR

public static final HandType TWO_PAIR

THREE_OF_A_KIND

public static final HandType THREE_OF_A_KIND

STRAIGHT

public static final HandType STRAIGHT

FLUSH

public static final HandType FLUSH

FULL_HOUSE

public static final HandType FULL_HOUSE

FOUR_OF_A_KIND

public static final HandType FOUR_OF_A_KIND

STRAIGHT_FLUSH

public static final HandType STRAIGHT_FLUSH

ROYAL_FLUSH

public static final HandType ROYAL_FLUSH
Constructor Detail

HandType

public HandType(java.lang.String name,
                int score)
Constructs a new HandType

Method Detail

toString

public java.lang.String toString()
Returns name of the hand.


getName

public java.lang.String getName()
Returns name of the hand.


beats

public boolean beats(HandType h)
Returns true if this hand beats another hand.


getScore

public int getScore()
Returns an arbitrary score for this hand. Higher is better.