All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.lotspiech.poker.SingletonCalculator

java.lang.Object
   |
   +----com.lotspiech.poker.SingletonCalculator

public class SingletonCalculator
extends Object
This is used to calculate the number of cards remaining in the deck, not counting pairs, three-of-a-kind, etc.

Author:
Jeffrey B. Lotspiech

Variable Index

 o COPYRIGHT
 o fromDeck
 o have
 o nonSingleton
 o table

Constructor Index

 o SingletonCalculator(int[], int[], int)
This creates a singleton calculator.

Method Index

 o allSingletons()
This method was created in VisualAge.
 o count(int, int, int)
This returns all the ways of getting singletons in the remaining cards in the deck, beginning with a certain rank, and going lower (in card value).

Variables

 o COPYRIGHT
 private static final String COPYRIGHT
 o table
 private int table[]
 o have
 private int have[]
 o fromDeck
 private int fromDeck[]
 o nonSingleton
 private int nonSingleton

Constructors

 o SingletonCalculator
 public SingletonCalculator(int have[],
                            int fromDeck[],
                            int maxDraw)
This creates a singleton calculator.

Parameters:
have - The ranks in the hand.
fromDeck - The ranks remaining in the deck.
maxDraw - Maximum number of draws. This is not used now, but could be used for further pre-calculations.

Methods

 o allSingletons
 public boolean allSingletons()
This method was created in VisualAge.

Returns:
boolean
 o count
 public int count(int startingRank,
                  int exclude,
                  int draw)
This returns all the ways of getting singletons in the remaining cards in the deck, beginning with a certain rank, and going lower (in card value).

Parameters:
rank - Rank to start with.
exclude - One rank to exclude, or -1.
draw - Cards to be drawn.
Returns:
Count.

All Packages  Class Hierarchy  This Package  Previous  Next  Index