public class Card
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Card[] |
allCards
an array of all unique Card objects
|
static java.util.HashMap<java.lang.Integer,java.lang.String> |
idStrMap
map from Card id numbers to String representations
|
static boolean[] |
isSuitRed
parallel array to suitNames indicating whether or not the corresponding suit is red
|
static int |
NUM_CARDS
total number of cards
|
static int |
NUM_RANKS
number of card ranks
|
static int |
NUM_SUITS
number of card suits
|
int |
rank
rank index (zero-based index to rankNames)
|
static java.lang.String[] |
rankNames
array of abbreviated card rank names in ascending order of rank and indexed by suit index
|
static java.util.HashMap<java.lang.String,Card> |
strCardMap
map from String representations to Card objects
|
static java.util.HashMap<java.lang.String,java.lang.Integer> |
strIdMap
map from String representations to Card id numbers
|
int |
suit
suit index (zero-based index to suitNames)
|
static java.lang.String[] |
suitNames
array of abbreviated card suit names indexed by suit index
|
Constructor and Description |
---|
Card(int rank,
int suit)
Constructor to create a card object with the corresponding zero-based indices to rankNames and suitNames, respectively.
|
Modifier and Type | Method and Description |
---|---|
int |
getId()
Return the Card id number.
|
int |
getRank()
Get rank of card (zero-based index to rankNames).
|
static java.util.Stack<Card> |
getShuffle(int seed)
Return a Stack deck of Cards corresponding to the give Microsoft FreeCell seed number
|
int |
getSuit()
Get suit of card (zero-based index to suitNames).
|
boolean |
isRed()
Return whether or not the card is Red.
|
static void |
main(java.lang.String[] args)
A test to show Microsoft shuffle 617.
|
java.lang.String |
toString() |
public static Card[] allCards
public static java.lang.String[] rankNames
public static java.lang.String[] suitNames
public static boolean[] isSuitRed
public static final int NUM_RANKS
public static final int NUM_SUITS
public static final int NUM_CARDS
public static java.util.HashMap<java.lang.String,Card> strCardMap
public static java.util.HashMap<java.lang.String,java.lang.Integer> strIdMap
public static java.util.HashMap<java.lang.Integer,java.lang.String> idStrMap
public final int rank
public final int suit
public Card(int rank, int suit)
rank
- rank of card (zero-based index to rankNames)suit
- suit of card (zero-based index to suitNames)public static java.util.Stack<Card> getShuffle(int seed)
seed
- Microsoft FreeCell seed numberpublic int getRank()
public int getSuit()
public boolean isRed()
public int getId()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- (not used)