package blackjack;
// Card.java


/** Card generates a random card out of a deck of 52
*/
public class SDCard
{
	// Instance Fields
	/** cardNum stores the number (0..51) of the card in the deck
	*/
	private int cardNum;
	/** Faces is the array of valid card face names Ace..King
	*/
	private String[] faces = {"Ace", "Two", "Three", "Four", "Five", "Six", "Seven",
	 									"Eight", "Nine", "Ten", "Jack", "Queen", "King"};
	private int[] values = {1,2,3,4,5,6,7,8,9,10,10,10,10};

	private String[] suits = {"Clubs", "Diamonds", "Hearts", "Spades"};

	private static boolean[] dealt = new boolean[52];

	// Constructors
	/** The Constructor creates a random card in a deck of 52
	*/
	public SDCard()
	{
		//cardNum = 31; // eventually need to do random (0..51)
		cardNum = (int)(Math.random() * 52);

		while (dealt[cardNum])
		{
			cardNum = (int)(Math.random() * 52);
		}
		dealt[cardNum] = true;
	}


	// Methods
	/** getSuit() returns the name of the suit of the card
		@return A string telling the card's suit
	*/
	public String getSuit()
	{
		//return "Clubs"; // eventually need to get actual suit
		return suits[ cardNum/13 ];
	}
	/** getFace returns the name of the card's face ("Ace".."King")
		@return A string telling the card's face value
	*/
	public String getFace()
	{
		//return "Ace"; // eventually need to get actual face value
		return   faces[ cardNum%13 ];
	}

	public static void shuffle()
	{
		for (int i=0; i < 52; i++)
			dealt[i] = false;
	}

	public int getValue()
	{
		return values[cardNum%13];
	}
}










