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

HardTotal() public method

public HardTotal ( ) : int
return int
        public int HardTotal()
        {
            int points = 0;

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

            return points;
        }

Usage Example

        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::HardTotal