Create a constructor that will allow anyone using the class to set the initial value of the card's suit and rank.
Create a method that will get a cards value. This should be based on the card's rank.
2-10 will use that as their value
face cards will use 10 as their value
Aces will have a value of 11
Aces will have an alternate value of 1
Make a method that will get a cards alternate value. This is based on Black Jack where Ace's can be 11 or 1.
If a card doesn't have an alternate value this method should return the card's normal value.
Create a static method that takes in two cards and returns -1, 0, or 1 based on comparing those card's values.
-1 means card 1 has a higher value
0 means the cards have the same value
1 means card 2 has a higher value
Make getter methods for the card's rank and suitMake a method to draw the card's face at a specific location on the screen passed into the method as an x and y value.
class Cards
{
private
static char HeartSymbol = Encoding.GetEncoding(437).GetChars(new byte[]{3})[0];
private
static char DiamondSymbol = Encoding.GetEncoding(437).GetChars(new byte[]{4})[0];
private
static char ClubSymbol = Encoding.GetEncoding(437).GetChars(new byte[]{5})[0];
private
static char SpadeSymbol = Encoding.GetEncoding(437).GetChars(new byte[]{6})[0];
public
static int Width = 5;
public
static int Height = 3;
public
enum Suits
{
Hearts = 0,
Diamonds,
Spades,
Clubs,
NUM_SUITS
};
public
enum Ranks
{
Ace = 1,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Jack,
Queen,
King,
NUM_RANKS
}
}
}
Comments
Leave a comment