GR.Gambling.Blackjack.Hand.SoftTotal C# (CSharp) Method

SoftTotal() public method

public SoftTotal ( ) : int
return int
        public int SoftTotal()
        {
            int points = 0;
            bool ace_counted = false;

            for (int i = 0; i < cards.Count; i++)
            {
                if (cards[i].IsAce())
                {
                    if (ace_counted)
                    {
                        points += 1;
                    }
                    else
                    {
                        points += 11;
                        ace_counted = true;
                    }
                }
                else
                {
                    points += cards[i].PointValue;
                }
            }

            return points;
        }

Usage Example

コード例 #1
0
        private double GetActionEV(Shoe tmp_shoe, CardSet active_hand, ActionType action, Card dealer_upcard)
        {
            Hand hand = new Hand(active_hand);

            SHand shand;
            int   soft_total = hand.SoftTotal();

            if (soft_total <= 21 && hand.HasAce())
            {
                shand.Total = soft_total;
                shand.Soft  = true;
            }
            else
            {
                shand.Total = hand.HardTotal();
                shand.Soft  = false;
            }

            int[] shoe_counts = tmp_shoe.ToArray();
            int   upcard      = dealer_upcard.PointValue;

            switch (action)
            {
            case ActionType.Stand:

                return(Eval.StandEv(shand, upcard, shoe_counts));

            case ActionType.Hit:

                return(Eval.HitEv(shand, upcard, shoe_counts));

            case ActionType.Double:

                return(Eval.DoubleEv(shand, upcard, current_bet, shoe_counts));

            case ActionType.Split:

                return(Eval.SplitEv(active_hand[0].PointValue, upcard, current_bet, max_splits - split_count, shoe_counts));

            case ActionType.Surrender:

                return(Eval.SurrenderEv());
            }

            return(-1);
        }
All Usage Examples Of GR.Gambling.Blackjack.Hand::SoftTotal