Example #1
0
        public static void DrawCardSuitValue(Card card, int xCoor, int yCoor)
        {
            char cardSuit = ' ';
            int x = xCoor * 12;
            int y = yCoor;

            switch (card.TheSuit)
            {
                case Card.Suit.hearts:
                    cardSuit = Encoding.GetEncoding(437).GetChars(new byte[] { 3 })[0];
                    Console.ForegroundColor = ConsoleColor.Red;
                    break;
                case Card.Suit.spades:
                    cardSuit = Encoding.GetEncoding(437).GetChars(new byte[] { 6 })[0];
                    Console.ForegroundColor = ConsoleColor.Black;
                    break;
                case Card.Suit.clubs:
                    cardSuit = Encoding.GetEncoding(437).GetChars(new byte[] { 5 })[0];
                    Console.ForegroundColor = ConsoleColor.Black;
                    break;
                case Card.Suit.diamonds:
                    cardSuit = Encoding.GetEncoding(437).GetChars(new byte[] { 4 })[0];
                    Console.ForegroundColor = ConsoleColor.Red;
                    break;
                default:
                    break;
            }
            Console.SetCursorPosition(x + 5, y + 5);
            Console.Write(cardSuit);
            Console.SetCursorPosition(x + 4, y + 7);
            Console.Write(card.TheValue);
        }
Example #2
0
 public HandEvaluator(Card[] sortedHand)
 {
     heartsSum = 0;
     diamondSum = 0;
     clubSum = 0;
     spadeSum = 0;
     cards = new Card[5];
     handvalue = new HandValue();
 }
Example #3
0
 // create deck of 52 cards: 13 values, each with 4 suits
 public void setUpDeck()
 {
     int i = 0;
     foreach (SUIT s in Enum.GetValues(typeof(SUIT)))
     {
         foreach (VALUE v in Enum.GetValues(typeof(VALUE)))
         {
             deck[i] = new Card { MySuit = s, MyValue = v };
             i++;
         }
     }
     ShuffleCards();
 }
Example #4
0
        // Create deck of 52 cards: 13 values, with 4 suits
        public void SetUpDeck()
        {
            int i = 0;

            foreach (Suit c in Enum.GetValues(typeof(Suit)))
            {
                foreach (Value v in Enum.GetValues(typeof(Value)))
                {
                    deck[i] = new Card { mySuit = c, myValue = v };
                    i++;
                }
            }
            ShuffleCards();
        }
Example #5
0
 internal void ShuffleCards()
 {
     Card card = new Card();
     Card card2 = new Card();
     int a, b;
     for (int i = 0; i < 52; i++)
     {
         a = rng.Next(0, 52);
         b = rng.Next(0, 52);
         card = deck[a];
         card2 = deck[b];
         deck[a] = card2;
         deck[b] = card;
     }
 }
Example #6
0
 internal void SetUpDeck()
 {
     Card card;
     for (int i = 0; i <= 3; i++)
     {
         for (int a = 0; a <= 12; a++)
         {
             card = new Card();
             card.TheSuit = (Card.Suit) i;
             card.TheValue = (Card.Value) a;
             deck.Add(card);
         }
     }
     ShuffleCards();
 }