public BTCard(int value, int gameValue, int index, BTCardSuit suit) { this.Value = value; this.Suit = suit; this.GameValue = gameValue; this.Index = index; }
public BTDeck() { cards = new BTCard[CardsInDeck]; var suits = new[] { BTCardSuit.Diamonds, BTCardSuit.Clubs, BTCardSuit.Hearts, BTCardSuit.Spades }; for (int i = 0; i < SuitsInDeck; i++) { BTCardSuit suit = suits[i]; for (int j = 0; j < CardsPerSuit; j++) { var index = j + (i * CardsPerSuit); var value = j + 1; int gameValue; switch (value) { case 1: // aces are high gameValue = 14; break; case 2: // 2's are the highest valued cards in this game. gameValue = 15; break; default: gameValue = value; break; } cards[index] = new BTCard(value, gameValue, index, suit); } } this.AddRange(cards); }
public static string ToEmoji(this BTCardSuit suit) { switch (suit) { case BTCardSuit.Diamonds: return("♦️"); case BTCardSuit.Clubs: return("♣️"); case BTCardSuit.Hearts: return("♥️"); case BTCardSuit.Spades: return("♠️"); default: throw new InvalidEnumArgumentException("WTF none of the 4 suits?"); } }