All Packages Class Hierarchy This Package Previous Next Index
Class com.lotspiech.poker.Hand
java.lang.Object
|
+----com.lotspiech.poker.BunchOfCards
|
+----com.lotspiech.poker.Hand
- public class Hand
- extends BunchOfCards
This class represents a hand of poker. It contains the logic for
calculating the expected counts from a given hand, with a given
remaining deck. It also can display a hand of cards. However, Hand
does not have a sense of the order of the cards. For that, the
HandWithDiscard subclass is used.
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
- See Also:
- Deck, BunchOfCards, Card, HandWithDiscard
-
chances
-
-
COPYRIGHT
-
-
draw
-
-
MAX_HAND
-
-
otherPairs
-
-
singleton
-
-
wildCount
-
-
wildDraw
-
-
Hand()
-
-
Hand(Card[])
- Any number of cards may be a "hand".
-
addArray(int[], int[])
- This method was created in VisualAge.
-
addChances()
-
-
calculateChances(Deck)
- This routine calculates all possible outcomes from a given hand,
and a given (remaining) deck.
-
countDraw(Deck)
-
-
flush(Deck)
-
-
fourOfAKind(Deck)
-
-
fullHouse(Deck)
-
-
getChances(String, int, int)
- You must execute "calculateChances" before calling this.
-
getCounts(String)
- This method was created in VisualAge.
-
main(String[])
- Testing program; arguments are the cards in the hand,
e.g.
-
multiplyArray(int[], int)
- This method was created in VisualAge.
-
noPair(Deck)
-
-
onePair(Deck)
-
-
showTotals()
-
-
straight(Deck)
-
-
straightByHighCard(Deck)
-
-
straightFlush(Deck)
-
-
straightFlushByHighCard(Deck)
-
-
subtractArray(int[], int[])
- This method was created in VisualAge.
-
threeOfAKind(Deck)
-
-
twoPair(Deck)
-
-
wildFiveOfAKind(Deck)
-
-
wildFlush(Deck, int)
-
-
wildFourDeuces(Deck)
- This calculates four wild ranked cards (no jokers); the
word "deuces" here a bit of a misnomer if deuces aren't the
wild rank.
-
wildFourOfAKind(Deck)
-
-
wildFullHouse(Deck)
-
-
wildOnePair(Deck)
- This method was created by a SmartGuide.
-
wildStraight(Deck, int)
-
-
wildStraightByHighCard(Deck, int)
-
-
wildStraightFlush(Deck, int)
-
-
wildStraightFlushByHighCard(Deck, int)
- In normal straight flush calculation, we are concerned about how
high an SF we can make.
-
wildThreeOfAKind(Deck)
- This method was created by a SmartGuide.
COPYRIGHT
private static final String COPYRIGHT
MAX_HAND
private static final int MAX_HAND
draw
private int draw
chances
private Dictionary chances
wildCount
private int wildCount[]
wildDraw
private int wildDraw[]
singleton
private SingletonCalculator singleton
otherPairs
protected int otherPairs[]
Hand
public Hand()
Hand
public Hand(Card cards[])
- Any number of cards may be a "hand".
addArray
private static int[] addArray(int a[],
int b[])
- This method was created in VisualAge.
- Parameters:
- a - int[]
- b - int[]
- Returns:
- int[]
addChances
private int addChances() throws Exception
calculateChances
public void calculateChances(Deck deck) throws Exception
- This routine calculates all possible outcomes from a given hand,
and a given (remaining) deck. In general, the order in which the hands are
calculated are important. More common hands need the results
from rarer hands. For example, three of a kind needs to know
the full house chances, so it can remove them.
countDraw
public int countDraw(Deck deck)
flush
private int[] flush(Deck deck)
fourOfAKind
private int[] fourOfAKind(Deck deck)
fullHouse
private int[] fullHouse(Deck deck)
getChances
public int getChances(String name,
int begin,
int len)
- You must execute "calculateChances" before calling this.
- Returns:
- The number of chances of a given type of hand.
getCounts
private int[] getCounts(String name)
- This method was created in VisualAge.
- Parameters:
- name - java.lang.String
- Returns:
- int[]
main
public static void main(String args[]) throws Exception
- Testing program; arguments are the cards in the hand,
e.g. "AS", "4D", etc.
- Parameters:
- args - "[ cards1 ] [ less [ cards2 ]] [ -deuces ] [ -joker ]"
multiplyArray
private static int[] multiplyArray(int a[],
int m)
- This method was created in VisualAge.
- Parameters:
- a - int[]
- m - int
- Returns:
- int[]
noPair
private int[] noPair(Deck deck) throws Exception
onePair
private int[] onePair(Deck deck)
showTotals
public String showTotals()
straight
private int[] straight(Deck deck)
straightByHighCard
private int[] straightByHighCard(Deck deck)
straightFlush
private int[] straightFlush(Deck deck)
straightFlushByHighCard
private int[] straightFlushByHighCard(Deck deck)
subtractArray
private static int[] subtractArray(int a[],
int b[])
- This method was created in VisualAge.
- Parameters:
- a - int[]
- b - int[]
threeOfAKind
private int[] threeOfAKind(Deck deck)
twoPair
private int[] twoPair(Deck deck)
wildFiveOfAKind
private int[] wildFiveOfAKind(Deck deck)
wildFlush
private int[] wildFlush(Deck deck,
int wild)
wildFourDeuces
private int[] wildFourDeuces(Deck deck)
- This calculates four wild ranked cards (no jokers); the
word "deuces" here a bit of a misnomer if deuces aren't the
wild rank.
wildFourOfAKind
private int[] wildFourOfAKind(Deck deck)
wildFullHouse
private int[] wildFullHouse(Deck deck)
wildOnePair
private int[] wildOnePair(Deck deck)
- This method was created by a SmartGuide.
- Parameters:
- deck - com.lotspiech.poker.Deck
- Returns:
- int[]
wildStraight
private int[] wildStraight(Deck deck,
int wild)
wildStraightByHighCard
private int[] wildStraightByHighCard(Deck deck,
int wild)
wildStraightFlush
private int[] wildStraightFlush(Deck deck,
int wild)
wildStraightFlushByHighCard
private int[] wildStraightFlushByHighCard(Deck deck,
int wild)
- In normal straight flush calculation, we are concerned about how
high an SF we can make. However, for the purpose of taking SFs out
of other hands (flushes and fours of a kind), we are interested in
we are interested in the highest actual card in the hand.
- Parameters:
- deck - The deck containing remaining cards.
- wild - The number of wild cards.
wildThreeOfAKind
private int[] wildThreeOfAKind(Deck deck)
- This method was created by a SmartGuide.
- Parameters:
- deck - com.lotspiech.poker.Deck
- Returns:
- int[]
All Packages Class Hierarchy This Package Previous Next Index