|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpoker.Deck
public class Deck
A Deck of 52 Cards which can be dealt and shuffled Some functions could be made much faster with some extra memory. I invite anyone to do so ;-)
Field Summary | |
---|---|
static int |
NUM_CARDS
|
Constructor Summary | |
---|---|
Deck()
Constructor. |
|
Deck(long seed)
Constructor w/ shuffle seed. |
Method Summary | |
---|---|
int |
cardsLeft()
Obtain the number of cards left in the deck |
Card |
deal()
Obtain the next card in the deck. |
Card |
dealCard()
Obtain a random card from the deck. |
void |
extractCard(Card c)
Remove a card from within the deck. |
void |
extractHand(Hand h)
Remove all cards in the given hand from the Deck. |
Card |
extractRandomCard()
Remove and return a randomly selected card from within the deck. |
int |
findCard(Card c)
Find position of Card in Deck. |
int |
findDiscard(Card c)
|
Card |
getCard(int i)
Obtain the card at a specific index in the deck. |
Card |
getTopCard()
Get the first card in the deck |
int |
getTopCardIndex()
Obtain the position of the top card. |
boolean |
inDeck(Card c)
See if a card is in the deck, or if it has been dealt. |
Card |
pickRandomCard()
Return a randomly selected card from within the deck without removing it. |
void |
replaceCard(Card c)
Place a card back into the deck. |
void |
reset()
Places all cards back into the deck. |
void |
setSeed(long seed)
|
void |
shuffle()
Places all cards back into the deck and then shuffles the deck. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NUM_CARDS
Constructor Detail |
---|
public Deck()
public Deck(long seed)
seed
- the seed to use in randomly shuffling the deck.Method Detail |
---|
public void setSeed(long seed)
public void reset()
public void shuffle()
public Card deal()
public Card dealCard()
public int findCard(Card c)
public int findDiscard(Card c)
public boolean inDeck(Card c)
c
- a card
public void extractHand(Hand h)
public void extractCard(Card c)
c
- the card to remove.public Card extractRandomCard()
public Card pickRandomCard()
public void replaceCard(Card c)
c
- the card to insert.public int getTopCardIndex()
public Card getTopCard()
public int cardsLeft()
public final Card getCard(int i)
i
- the index into the deck (0..51)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |