|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectglassfrog.model.Deck
public class Deck
A Class given to represent a standard 52 card, 4 suit deck of playing cards.
Field Summary | |
---|---|
private java.util.ArrayList<Card> |
deck
|
private static int |
DECK_SHUFFLE
|
private static int |
NUM_RANKS
|
private static int |
NUM_SUITS
|
private int |
numUsedCards
|
private static java.lang.Integer[] |
ranks
|
private java.util.Random |
rng
|
private static java.lang.String[] |
suits
|
private int |
usedIndex
|
Constructor Summary | |
---|---|
Deck(int seed)
Construtor specifying a seed to set our RNG with. |
Method Summary | |
---|---|
Hand |
dealHand(int numPlayers,
int numRounds,
int[] numPrivateCards,
int[] numPublicCards)
Deals a new hand from the deck. |
Card |
getCard(int cardIndex)
Return a card at a given index in the deck |
Card |
getNextCard()
Get the next unused Card in the deck. |
void |
shuffle()
Shuffles the top N cards where N is the amount of cards that are needed in order to draw a hand based on the information specified by the dealer. |
java.lang.String |
toString()
Returns the deck, in array indexed order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int DECK_SHUFFLE
private static final int NUM_SUITS
private static final int NUM_RANKS
private static final java.lang.String[] suits
private static final java.lang.Integer[] ranks
private java.util.Random rng
private int numUsedCards
private int usedIndex
private java.util.ArrayList<Card> deck
Constructor Detail |
---|
public Deck(int seed)
seed
- An int used to seed the deck to create repeatable dealsMethod Detail |
---|
public Card getCard(int cardIndex)
cardIndex
- The index from which to draw the card
public Card getNextCard()
public void shuffle()
public java.lang.String toString()
toString
in class java.lang.Object
public Hand dealHand(int numPlayers, int numRounds, int[] numPrivateCards, int[] numPublicCards)
numPlayers
- An integer representing the number of playersnumRounds
- An integer representing the number of roundsnumPrivateCards
- An array of integers where the index is the round
and the value is the number of private cards for each player for that roundnumPublicCards
- An array of integers where the index is the round
and the value is the number of public cards for that round
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |