Ejemplo n.º 1
0
 public static string ToDescriptionString(this SymbolEnum val)
 {
     DescriptionAttribute[] attributes = (DescriptionAttribute[])val
                                         .GetType()
                                         .GetField(val.ToString())
                                         .GetCustomAttributes(typeof(DescriptionAttribute), false);
     return(attributes.Length > 0 ? attributes[0].Description : string.Empty);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// The constructor used to build a card.
 /// </summary>
 /// <param name="suit">The suit of the card.</param>
 /// <param name="symbol">The symbol of the card.</param>
 public Card(
     SuitEnum suit,
     SymbolEnum symbol)
 {
     Suit         = suit;
     Symbol       = symbol;
     SuitString   = suit.ToString();
     SymbolString = symbol.ToString();
     CardValue    = (int)symbol;
     IsAce        = Symbol == SymbolEnum.Ace;
     IsFaceCard   = Value >= (int)SymbolEnum.Jack;
 }
Ejemplo n.º 3
0
 private string ToString(string indent)
 {
     if (symbol == SymbolEnum.NUM)
     {
         return(indent + ((double)(value[0])).ToString());
     }
     else
     {
         return(indent + symbol.ToString() + Environment.NewLine
                + ((AstNode)(value[0])).ToString(indent + "  ") + Environment.NewLine
                + ((AstNode)(value[1])).ToString(indent + "  "));
     }
 }