Beispiel #1
0
 public static char GetSuit(SuitCard c)
 {
     if (c.Suit == Suits.INVALID)
         throw new ArgumentException("Can't have invalid value as the suit.");
     switch (c.Suit) {
         case Suits.Hearts:
             return Hearts;
         case Suits.Diamonds:
             return Diamonds;
         case Suits.Clubs:
             return Clubs;
         case Suits.Spades:
             return Spades;
     }
     return '\u0000';
 }
Beispiel #2
0
 public static string GetValue(SuitCard c)
 {
     if (c.Suit == Suits.INVALID)
         throw new ArgumentException("Can't have invalid value as the value.");
     if (c.Value == Values.A) return "A";
     else if (c.Value == Values.J) return "J";
     else if (c.Value == Values.Q) return "Q";
     else if (c.Value == Values.K) return "K";
     else return ((int)c.Value).ToString();
 }
Beispiel #3
0
 private static int CardValue(SuitCard c)
 {
     int suit = ((int)c.Suit * 100);
     int value = (int)c.Value;
     return suit + value;
 }