예제 #1
0
 /// <summary>
 /// create Black Jack data from Card
 /// </summary>
 /// <param name="card"></param>
 /// <param name="internalDeckId"></param>
 public void AddCardData(Card card, int internalDeckId)
 {
     m_suit           = (int)card.Suit();
     m_id             = card.CardId();
     m_isTurned       = card.IsTurned();
     m_internalDeckId = internalDeckId;
     m_z     = card.m_z;
     m_value = ComputeCardValue(card);
 }
예제 #2
0
 public BlackJackData(Card c)
 {
     if (c != null)
     {
         m_suit           = (int)c.Suit();
         m_id             = c.CardId();
         m_internalDeckId = 10;
         m_isTurned       = false;
         m_z     = c.m_z;
         m_value = 0;
         if (c.CardId() > 1 && c.CardId() < 11)
         {
             m_value = c.CardId();
         }
         else
         {
             if (c.CardId() > 10)
             {
                 m_value = 10;
             }
             if (c.CardId() == 1)
             {
                 m_value = 11;
             }
         }
     }
 }
예제 #3
0
        /// <summary>
        /// determines the value of given card for the game
        /// </summary>
        /// <param name="card"></param>
        /// <returns></returns>
        private int ComputeCardValue(Card card)
        {
            switch (card.CardId())
            {
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
                return(card.CardId());

            case 11:
            case 12:
            case 13:
                return(10);
            }
            return(0);
        }