Пример #1
0
        // return true = should doubledown
        public virtual bool DetermineDoubleDown(HouseHand dealerHand, Hand playerHand, StatisticsMgr stats)
        {
            if (stats.WinStreak > 3 ||
                !playerHand.IsDoubleDownable)
            {
                // just don't
                return(false);
            }

            // if the dealer's shown card is not a 10 pt or ace, continue
            if (dealerHand.CardShowing.Face == 1 ||
                (dealerHand.CardShowing.Face > 9 && stats.TensIndex > 2))
            {
                return(false);
            }

            if (playerHand.HasAce && playerHand.SumCards < 14 && stats.TensIndex > 4)
            {
                return(true);
            }

            // if the card sum is between 9 and 12
            if (playerHand.SumCards < 12 &&
                playerHand.SumCards >= 9)
            {
                if (dealerHand.CardShowing.Face < 9)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #2
0
        // the first hand returned is for the player, the second is for the house
        public Tuple <Hand, Hand> DealHands(Hand hand)
        {
            // use the default if hand is null
            if (null == hand)
            {
                hand = new Hand();
            }

            DealerHand = new HouseHand();

            // get two cards for both hands
            hand.AddCardShowing(_shoe[0]);
            _shoe.RemoveAt(0);

            hand.AddCardShowing(_shoe[0]);
            _shoe.RemoveAt(0);

            // now create the hand for the house
            DealerHand.AddCard(_shoe[0]);
            _shoe.RemoveAt(0);

            DealerHand.AddCardShowing(_shoe[0]);
            _shoe.RemoveAt(0);
            if (_shoe.Count < 52)
            {
                Shuffle();
            }
            PlayerHand      = hand;
            PlayerSplitHand = null;
            return(new Tuple <Hand, Hand>(hand, DealerHand));
        }
Пример #3
0
        // this is logic to determine if the player should split the hand
        public virtual bool DetermineSplit(HouseHand dealerHand, Hand playerHand, StatisticsMgr stats)
        {
            // don't do anything special if it's not likely to work
            if (
                stats.WinStreak > 4
                ||
                (stats.LosingStreak > 0 && stats.LosingStreak < 3) ||
                !playerHand.IsSplittable
                )
            {
                return(false);
            }

            // split a pair of aces
            if (playerHand.SumCards == 2)
            {
                return(true);
            }

            // avoid pair of 4s, pair of 5s
            if (
                // more likely to have 18 or 20 in these cases, so don't  split
                (
                    stats.TensIndex < 5 &&
                    (playerHand.SumCards == 8 || playerHand.SumCards == 10)
                )
                )
            {
                return(false);
            }

            if (Math.Min(dealerHand.CardShowing.Face, (byte)10) >= playerHand.Cards[0].Face)
            {
                return(false);
            }

            if (dealerHand.CardShowing.Face == 1)
            {
                return(false);
            }

            return(true);
        }