All Packages Class Hierarchy This Package Previous Next Index
Class com.lotspiech.poker.StraightCalculator
java.lang.Object
|
+----com.lotspiech.poker.StraightCalculator
- public class StraightCalculator
- extends Object
This class is used to calculate straights and straight flushes.
Copyright 2001, 2002 by Jeffrey B. Lotspiech. This program is open source;
it is licensed under the Common Public License Version 0.5.
- Author:
- Jeffrey B. Lotspiech
-
COPYRIGHT
-
-
draw
-
-
fromDeck
-
-
have
-
-
wild
-
-
StraightCalculator(int[], int[], int, int)
- This method was created in VisualAge.
-
countRun(int, int, int, int)
- This function is a used subroutine in the straight and straight flush
calculations.
-
straight()
- This calculates straights the normal way.
-
straightByHighCard()
- This calculates straight by actual high card.
COPYRIGHT
private static final String COPYRIGHT
have
private int have[]
fromDeck
private int fromDeck[]
draw
private int draw
wild
private int wild
StraightCalculator
public StraightCalculator(int have[],
int fromDeck[],
int draw,
int wild)
- This method was created in VisualAge.
- Parameters:
- have - Cards that we already have, by rank.
- fromDeck - Cards available from the deck, by rank.
- draw - Number of cards to be drawn.
- wild - Number of wild cards available to fill gaps.
countRun
private int countRun(int rank,
int run,
int draw,
int gap)
- This function is a used subroutine in the straight and straight flush
calculations. It is recursive.
straight
public int[] straight()
- This calculates straights the normal way. In other words,
if there are gaps at the end, they are assumed to be at
the high end (ace, king, etc.).
- Returns:
- The counts for each starting rank. An ace/five straight is shown as starting as "five".
straightByHighCard
public int[] straightByHighCard()
- This calculates straight by actual high card.
In normal straight calculation, we are concerned about how
high a straight we can make. However, for the purpose of taking straights out
of other hands, we want to know the actual highest card. In other words,
we don't want any wild cards to make the straight higher than the highest
actual card.
All Packages Class Hierarchy This Package Previous Next Index