public bool DoHit(model.Player a_dealer)
        {
            int[] cardScores = a_dealer.getCardScoreArray();
            total = 0;

            if (a_dealer.CalcScore() < 17)
            {
                return true;
            }

            if (a_dealer.CalcScore() == 17){

                foreach (Card c in a_dealer.GetHand())
                {
                    if (c.GetValue() != Card.Value.Ace)
                    {
                        total += cardScores[(int)c.GetValue()];
                    }
                }
                //if this is true a soft 17 is active.
                if (total <= 6)
                {
                    return true;
                }
            }

            return false;
        }
        public bool DoHit(model.Player a_dealer)
        {
            if (a_dealer.CalcScore() == g_hitLimit)
            {
                int otherValue = 0;
                bool aceFound = false;
                int[] cardScores = new int[(int)model.Card.Value.Count] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11 };

                foreach (Card card in a_dealer.GetHand())
                {
                    if (card.GetValue() == Card.Value.Ace && !aceFound)
                    {
                        aceFound = true;
                    } else {
                        otherValue += cardScores[(int)card.GetValue()];
                        if (otherValue > 6)
                        {
                            return false;
                        }
                    }
                }
                if (otherValue == 6 && aceFound)
                {
                    return true;
                }
            }
            return a_dealer.CalcScore() < g_hitLimit;
        }
示例#3
0
        public bool DoHit(model.Player a_dealer)
        {
            var cards = a_dealer.GetHand();

            // Check if limit has reached....
            if (a_dealer.CalcScore() == g_hitLimit)
            {
                foreach (var card in cards)
                {
                    // Must hit if ace in hand. Because score IS 17!
                    //Ace turns into 1 score instead
                    if (card.GetValue() == Card.Value.Ace)
                    {
                        return true;
                    }
                }
            }

            // No special circumstances....
            if (a_dealer.CalcScore() < g_hitLimit)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
示例#4
0
 public bool DoHit(model.Player a_dealer)
 {
     if (a_dealer.CalcScore() == g_hitLimit)
     {
         return DealerHasAce(a_dealer.GetHand());
     }
     return a_dealer.CalcScore() < g_hitLimit;
 }
 public bool DoIsDealerWinner(model.Player a_dealer, model.Player a_player)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return true;
     }
     else if (a_dealer.CalcScore() > g_maxScore)
     {
         return false;
     }
     return a_dealer.CalcScore() > a_player.CalcScore();
 }
示例#6
0
 public bool DoHit(model.Player a_dealer)
 {
     if(a_dealer.CalcScore() < g_hitLimit)
     {
         return true;
     }
         //checks to see if the amount of ace is atleast of half the dealers cards to make sure the dealer doesnt hit at a hard 17. Example ace + 6 + 10
     else if (a_dealer.GetHand().Count(x => x.GetValue() == Card.Value.Ace)*2 >= a_dealer.GetHand().Count() && a_dealer.CalcScore() <= g_hitLimit)
     {
         return true;
     }
     return false;
 }
        public bool IsDealerWinner(model.Player a_player, model.Dealer a_dealer, int maxScore)
        {
            if (a_player.CalcScore() > maxScore)
            {
                return true;
            }
            else if (a_dealer.CalcScore() > maxScore)
            {
                return false;
            }

            return a_dealer.CalcScore() >= a_player.CalcScore();
        }
示例#8
0
 public bool DoHit(model.Player a_dealer)
 {
     int a = a_dealer.CalcScore();
     if (a == 17)
     {
         foreach (Card c in a_dealer.GetHand())
         {
             if (c.GetValue() == Card.Value.Ace)
             {
                 return true;
             }
         }
     }
     return a_dealer.CalcScore() < g_hitLimit;
 }
示例#9
0
        public bool DoHit(model.Player a_dealer)
        {
            int score = a_dealer.CalcScore(false);  // parameter false means don't calcScore using Ace as 1 but only 11
            if (score == g_hitLimit)
            {
                foreach (Card c in a_dealer.GetHand())
                {
                    if (c.GetValue() == Card.Value.Ace)
                    {
                        return true;
                    }
                }
            }

            return a_dealer.CalcScore() < g_hitLimit;
        }
        public bool DoHit(model.Player a_dealer)
        {
            int score = a_dealer.CalcScore();

            if (score < g_hitLimit)
            {
                return true;
            }

            if (score == g_hitLimit)
            {
                foreach (Card c in a_dealer.GetHand())
                {
                    //If Ace is in the hand, checks if score without Ace is 6
                    if ((c.GetValue() == Card.Value.Ace) && (score - 11 == 6))
                    {
                        score -= 10;
                    }
                }

                return score < g_hitLimit;
            }

            return false;
        }
        //Hit if score is 17 or less
        public bool DoHit(model.Player a_dealer)
        {
            var cards = a_dealer.GetHand();

            if(a_dealer.CalcScore() == g_hitLimit)
            {
                foreach(Card card in cards)
                {
                    if (card.GetValue() == Card.Value.Ace && a_dealer.CalcScore() - 11 == 6)
                    {
                        return true;
                    }
                }
            }

            return a_dealer.CalcScore() < g_hitLimit;
        }
示例#12
0
        public bool DoHit(model.Player a_dealer)
        {
            if(a_dealer.CalcScore() == g_hitLimit)
            {
                IEnumerable<Card> aces = a_dealer.GetHand().Where(c => c.GetValue() == Card.Value.Ace);                //get all aces from hand
                IEnumerable<Card> handWithoutAces = a_dealer.GetHand().Where(c => c.GetValue() != Card.Value.Ace);     //get all other cards from hand

                int score = a_dealer.CalcCardsScore(handWithoutAces);          //calc score of hand without aces

                return aces.Count() > 0 && score == 6;                        //return if there is aces and score of other cards is 6
            }

            else
            {
                return a_dealer.CalcScore() < g_hitLimit;
            }
        }
示例#13
0
        public bool Winner(model.Player a_dealer, Player a_player)
        {
            if (a_dealer.CalcScore() > g_maxScore)
            {
                return false;
            }

            else if (a_player.CalcScore() > g_maxScore)
            {
                return true;
            }

            else
            {
                return a_player.CalcScore() < a_dealer.CalcScore();
            }
        }
示例#14
0
        public bool DoHit(model.Player a_dealer)
        {
            int[] cardScore = a_dealer.getCardArrayValues();
            int total = 0;

            if (a_dealer.CalcScore() == g_hitLimit)
            {
                foreach (Card card in a_dealer.GetHand())
                {
                    if (card.GetValue() != Card.Value.Ace)
                    {
                      total += cardScore[(int)card.GetValue()];
                    }
                }
                return total <= 6;
            }

            return a_dealer.CalcScore() < g_hitLimit;
        }
示例#15
0
        public bool DoHit(model.Player a_dealer)
        {
            IEnumerable<Card> cardList = a_dealer.GetHand();
            if (a_dealer.CalcScore() < g_hitLimit)
            {
                return true;
            }

            if (a_dealer.CalcScore() == g_hitLimit)
            {
                foreach (Card card in cardList)
                {
                    if (card.GetValue() == Card.Value.Ace)
                    {
                        return true;
                    }
                }
            }
            return false;
        }
示例#16
0
文件: SoftHit.cs 项目: ks222rt/1DV607
 public bool DoHit(model.Player a_dealer)
 {
     if (a_dealer.CalcScore() == g_hitLimit && aceHit == false)
     {
         foreach (Card c in a_dealer.GetHand())
         {
             if (c.GetValue() == Card.Value.Ace && a_dealer.CalcScore() == g_hitLimit)
             {
                 aceHit = true;
                 return true;
             }
         }
     }
     if (a_dealer.CalcScore() < g_hitLimit)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
        public bool DoHit(model.Player a_dealer)
        {
            int score = 0;

            if (a_dealer.CalcScore() == 17)
            {
                foreach (Card c in a_dealer.GetHand())
                {
                    score += (int)c.GetValue();

                    if (c.GetValue() == Card.Value.Ace)
                    {
                        score += 0;
                    }
                }

                if(score == 6){
                    return true;
                }
            }

            return a_dealer.CalcScore() < g_hitLimit;
        }
        public bool DoHit(model.Player a_dealer)
        {
            bool hasAce = false;
            foreach (Card c in a_dealer.GetHand())
            {
                if (c.GetValue() == Card.Value.Ace)
                {
                    hasAce = true;
                    break;
                }
            }

            int score = a_dealer.CalcScore();
            return (score < g_hitLimit ||
                    (score == g_hitLimit && hasAce));
        }
示例#19
0
        public bool DoHit(model.Player a_dealer)
        {
            int score = a_dealer.CalcScore();

            if(score == g_hitLimit){
                foreach(Card c in a_dealer.GetHand()){
                    if(c.GetValue() == Card.Value.Ace && (score - 11) == 6){
                        score -= 10;
                    }
                }
                return score < g_hitLimit;
            }
            else if(score < g_hitLimit){
                return true;
            }
            return false;
        }
示例#20
0
        public bool DoHit(model.Player a_dealer)
        {
            var hand = a_dealer.GetHand();
            int score = a_dealer.CalcScore();

            // If the dealer has 17.
            if (score == g_hitLimit)
            {
                foreach (var card in hand)
                {
                    // In a comibination of Ace and 6.
                    if (card.GetValue() == Card.Value.Ace && score - 11 == 6)
                    {
                        // The dealer does another hit.
                        return true;
                    }
                }
            }

            return score < g_hitLimit;
        }
示例#21
0
 public bool DoHit(model.Player a_dealer)
 {
     var cards = a_dealer.GetHand();
     var score = a_dealer.CalcScore();
     if (score < g_hitLimit)
     {
         return true;
     }
     else if (score == g_hitLimit)
     {
         foreach (var card in cards)
         {
             if (card.GetValue() == Card.Value.Ace && score - 11 == 6)
             {
                 score -= 10;
             }
             return score < g_hitLimit;
         }
     }
     return false;
 }
        /*Detta är vår tolkning på problembeskrvningen utav soft17
         * (Ändring kan ske vid kontakt med "kunden"). */
        public bool DoHit(model.Player a_dealer)
        {
            int score = a_dealer.CalcScore();

            if (score == 17)
            {
                foreach (Card c in a_dealer.GetHand())
                {
                    if (!once)
                    {
                        if (c.GetValue() == Card.Value.Ace)
                        {

                            score -= 10;
                            once = true;

                        }
                    }
                }
            }

            return score < g_hitLimit;
        }
示例#23
0
 public bool DoHit(model.Player a_dealer)
 {
     return (a_dealer.GetHand().Any(w => w.GetValue() == Card.Value.Ace) && a_dealer.CalcScore() == g_hitLimit) || a_dealer.CalcScore() < g_hitLimit;
 }
 public bool DoHit(model.Player a_dealer)
 {
     return a_dealer.CalcScore() < g_hitLimit;
 }