GR.Gambling.Blackjack.HandSet.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            StringBuilder result = new StringBuilder();

            for (int i = 0; i < hands.Count; i++)
            {
                result.Append(string.Format("Hand {0,1}:   {1,-12}", i+1, hands[i]));

                result.Append(string.Format(" = {0} ", hands[i].PointCount()));

                if (hands[i].IsSplit()) result.Append("(split)");
                else if (hands[i].Doubled) result.Append("(doubled)");
                else if (hands[i].IsBust()) result.Append("(busted)");
                else if (hands[i].IsNatural()) result.Append("(BJ)");
                else if (hands[i].Surrendered) result.Append("(surrendered)");
                else
                {
                    if (active_index == i && !hands[i].Finished) result.Append("(*)");
                }

                result.AppendLine();
            }

            return result.ToString();
        }

Usage Example

示例#1
0
        public override string ToString()
        {
            StringBuilder result = new StringBuilder();

            result.AppendLine("Shoe: " + shoe.ToCountsString());
            result.AppendLine();

            result.Append(string.Format("Dealer:   {0,-12} = {1}", dealer_hand, dealer_hand.PointCount()));
            if (dealer_hand.IsNatural())
            {
                result.Append(" (BJ)");
            }
            if (dealer_hand.IsBust())
            {
                result.Append(" (busted)");
            }
            result.AppendLine();

            result.AppendLine();

            result.AppendLine(player_handset.ToString());

            return(result.ToString());
        }