Exemplo n.º 1
0
        // Returns the players name plus their hand and total score.
        public override void SetHandAsString()
        {
            HandAsString = Name + ": ";

            foreach (Card card in Hand)
            {
                HandAsString += card.Name + card.Suit + " ";
            }

            HandAsString += " Total: " + HandTotal.ToString();

            if (HandTotal > 21)
            {
                HandAsString += "  Bust!";
            }
        }
Exemplo n.º 2
0
        // Returns the house name plus their hand and total score.
        public override void SetHandAsString()
        {
            HandAsString = Name + ": ";

            if (firstCardFlipped == false)
            {
                if (HandTotal == 21)
                {
                    foreach (Card card in Hand)
                    {
                        HandAsString += card.Name + card.Suit + " ";
                    }

                    HandAsString += " Total: " + HandTotal.ToString();
                }
                else if (HandTotal > 21)
                {
                    foreach (Card card in Hand)
                    {
                        HandAsString += card.Name + card.Suit + " ";
                    }

                    HandAsString += " Total: " + HandTotal.ToString() + "  House Bust!";
                }
                else
                {
                    HandAsString += "XX ";

                    for (int i = 1; i < Hand.Count; i++)
                    {
                        HandAsString += Hand[i].Name + Hand[i].Suit + " ";
                    }
                }
            }
            else
            {
                if (HandTotal == 21)
                {
                    foreach (Card card in Hand)
                    {
                        HandAsString += card.Name + card.Suit + " ";
                    }

                    HandAsString += " Total: " + HandTotal.ToString();
                }
                else if (HandTotal > 21)
                {
                    foreach (Card card in Hand)
                    {
                        HandAsString += card.Name + card.Suit + " ";
                    }

                    HandAsString += " Total: " + HandTotal.ToString() + "  House Bust!";
                    Bust          = true;
                }
                else
                {
                    for (int i = 0; i < Hand.Count; i++)
                    {
                        HandAsString += Hand[i].Name + Hand[i].Suit + " ";
                    }

                    HandAsString += " Total: " + HandTotal.ToString();
                }
            }
        }