예제 #1
0
        public bool GetGameWinnerRule(model.Player a_dealer, model.Player a_player)
        {
            if (a_dealer.CalcScore() > g_maxScore && a_player.CalcScore() > g_maxScore && a_dealer.CalcScore() < a_player.CalcScore())
            {
                return(false);
            }

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

            else if (a_dealer.CalcScore() <= g_maxScore && a_player.CalcScore() > g_maxScore)
            {
                return(true);
            }

            else if (a_dealer.CalcScore() > g_maxScore && a_player.CalcScore() <= g_maxScore)
            {
                return(false);
            }

            else if (a_dealer.CalcScore() <= g_maxScore && a_player.CalcScore() <= g_maxScore && a_dealer.CalcScore() > a_player.CalcScore())
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }
예제 #2
0
        public bool DoHit(model.Player a_dealer)
        {
            // Om äss, och summan av handen är 17
            bool isSoft17 = a_dealer.CalcScore() == 17 && a_dealer.GetHand().Any(card => card.GetValue() == Card.Value.Ace);

            return(isSoft17 || a_dealer.CalcScore() < 17);
        }
예제 #3
0
파일: Easy.cs 프로젝트: sh222td/Portfolio
        public bool EasyWinningRule(model.Player a_dealer, model.Player a_player)
        {
            if (a_dealer.CalcScore() == a_player.CalcScore())
            {
                return(false);
            }

            if (a_dealer.CalcScore() > a_player.CalcScore() && a_dealer.CalcScore() < 21)
            {
                return(true);
            }

            if (a_dealer.CalcScore() > g_maxScore)
            {
                return(false);
            }
            else if (a_dealer.CalcScore() == 21)
            {
                return(true);
            }

            if (a_player.CalcScore() > g_maxScore)
            {
                return(true);
            }
            else if (a_player.CalcScore() == 21)
            {
                return(false);
            }
            return(false);
        }
예제 #4
0
        public bool DoHit(model.Player a_dealer)
        {
            // This rule presumes limit of cards is 5
            bool isUnderLimit = a_dealer.CalcScore() < g_hitLimit;
            bool isSoft17     = a_dealer.CalcScore() == g_hitLimit && a_dealer.HasAce();

            return(isUnderLimit || isSoft17);
        }
예제 #5
0
 public bool DoHit(model.Player a_dealer, model.Player a_player)
 {
     if (a_dealer.CalcScore() > a_player.CalcScore())
     {
         return(false);
     }
     return(a_dealer.CalcScore() < g_hitLimit || a_dealer.CalcScore() < a_player.CalcScore());
 }
예제 #6
0
        public bool DoHit(model.Player a_dealer)
        {
            if (a_dealer.CalcScore() == 17 && a_dealer.hasAce())
            {
                return(true);
            }

            return(a_dealer.CalcScore() < g_hitLimit);
        }
        public bool DoHit(model.Player a_dealer)
        {
            if (a_dealer.CalcScore() == SoftHitLimit &&
                HasAnAce(a_dealer))
            {
                return(true);
            }

            return(a_dealer.CalcScore() < SoftHitLimit);
        }
 public bool DoHit(model.Player a_dealer)
 {
     foreach (Card c in a_dealer.GetHand())
     {
         if (c.GetValue() == Card.Value.Ace && a_dealer.CalcScore() == g_hitLimit)
         {
             return(true);
         }
     }
     return(a_dealer.CalcScore() < g_hitLimit);
 }
예제 #9
0
 public bool DoCheckWinner(model.Dealer a_dealer, model.Player a_player)
 {
     if (a_dealer.CalcScore() == a_player.CalcScore())
     {
         return(true);
     }
     else
     {
         return(a_dealer.CalcScore() > a_player.CalcScore());
     }
 }
예제 #10
0
 public bool IsDealerWinner(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());
 }
예제 #11
0
 public bool DidWin(model.Player playerOne, model.Player playerTwo, int maxScore)
 {
     if (playerTwo.CalcScore() > maxScore)
     {
         return(true);
     }
     else if (playerOne.CalcScore() > maxScore)
     {
         return(false);
     }
     return(playerOne.CalcScore() >= playerTwo.CalcScore());
 }
 public bool DoHit(model.Player a_dealer)
 {
     if (a_dealer.CalcScore() < g_hitLimit)
     {
         return(true);
     }
     if (a_dealer.CalcScore() == g_hitLimit)
     {
         return(a_dealer.GetHand().Any(c => c.GetValue() == Card.Value.Ace));
     }
     return(false);
 }
예제 #13
0
        public bool DoHit(model.Player a_dealer)
        {
            List <Card> list = (List <Card>)a_dealer.GetHand();

            if (a_dealer.CalcScore() == g_hitLimit)
            {
                return(list.Exists(x => x.GetValue() == Card.Value.Ace));
            }
            else
            {
                return(a_dealer.CalcScore() < g_hitLimit);
            }
        }
예제 #14
0
        public bool DoHit(model.Player a_dealer)
        {
            IEnumerable <Card> cards = a_dealer.GetHand();

            foreach (Card card in cards)
            {
                if (card.GetValue() == Card.Value.Ace && a_dealer.CalcScore() == g_hitLimit)
                {
                    return(true);
                }
            }
            return(a_dealer.CalcScore() < g_hitLimit);
        }
예제 #15
0
        public Boolean IsDealerWinner(model.Dealer a_dealer, model.Player a_player)
        {
            int maxScore = a_dealer.getMaxScore();

            if (a_player.CalcScore() > maxScore)
            {
                return(true);
            }
            else if (a_dealer.CalcScore() > maxScore)
            {
                return(false);
            }
            return(a_dealer.CalcScore() > a_player.CalcScore());
        }
예제 #16
0
        public bool DoHit(model.Player a_dealer, model.Player a_player)
        {
            if (a_dealer.CalcScore() > a_player.CalcScore())
            {
                return(false);
            }

            if (a_dealer.CalcScore() < g_softHitLimit && isSoftHand(a_dealer))
            {
                return(true);
            }
            else
            {
                return(a_dealer.CalcScore() < g_hitLimit || a_dealer.CalcScore() < a_player.CalcScore());
            }
        }
 public bool DoHit(model.Player a_dealer)
 {
     // Added code.
     if (a_dealer.CalcScore() == g_hitLimit && a_dealer.IsSoftSeventeen())
     {
         return(true);
     }
     else if (a_dealer.CalcScore() < g_hitLimit)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #18
0
 public bool IsDealerWinner(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);
     }
     else if (a_dealer.CalcScore() > a_player.CalcScore())
     {
         return(true);
     }
     return(false); //if dealer and player have the same score
 }
예제 #19
0
 public bool isDealerWinner(model.Player a_dealer, model.Player a_player, int maxScore)
 {
     if (a_player.CalcScore() > maxScore)
     {
         return(true);
     }
     else if (a_dealer.CalcScore() > maxScore)
     {
         return(false);
     }
     else if (a_dealer.CalcScore() == a_player.CalcScore())  // Same score, player wins
     {
         return(false);
     }
     return(a_dealer.CalcScore() > a_player.CalcScore());
 }
예제 #20
0
 public bool CheckDealerWon(model.Player a_dealer, model.Player a_player, int g_maxScore)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return(true);
     }
     if (a_dealer.CalcScore() > g_maxScore)
     {
         return(false);
     }
     if (a_dealer.CalcScore() > a_player.CalcScore())
     {
         return(true);
     }
     return(false);
 }
예제 #21
0
        public bool DoHit(model.Player a_dealer)
        {
            int dealerScoreAceLowered    = a_dealer.CalcScore();
            int dealerScoreAceNotLowered = 0;

            int[] cardScores = new int[(int)model.Card.Value.Count]
            {
                2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11
            };

            foreach (Card c in a_dealer.GetHand())
            {
                if (c.GetValue() != Card.Value.Hidden)
                {
                    dealerScoreAceNotLowered += cardScores[(int)c.GetValue()];
                }

                if (dealerScoreAceNotLowered == 17 && c.GetValue() == Card.Value.Ace)
                {
                    return(dealerScoreAceNotLowered < g_softHitLimit);
                }
            }

            return(dealerScoreAceLowered < g_hardHitLimit);
        }
예제 #22
0
        public bool DoHit(model.Player a_dealer)
        {
            IEnumerable <Card> hand = a_dealer.GetHand();

            if (a_dealer.CalcScore() == 17)
            {
                foreach (var card in hand)
                {
                    if (card.GetValue() == Card.Value.Ace)
                    {
                        return(true);
                    }
                }
            }
            return(a_dealer.CalcScore() < g_hitLimit);
        }
예제 #23
0
        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);
        }
예제 #24
0
 public void RedrawAndShowHand(model.Dealer a_dealer, model.Player a_player)
 {
     System.Threading.Thread.Sleep(2000);
     DisplayWelcomeMessage();
     DisplayDealerHand(a_dealer.GetHand(), a_dealer.CalcScore());
     DisplayPlayerHand(a_player.GetHand(), a_player.CalcScore());
 }
예제 #25
0
        // return true if score is 17 and dealer has an Ace,
        // else return true/false depending on if dealer has
        // a score lower than the hit limit.
        public bool DoHit(model.Player a_dealer)
        {
            IEnumerable <Card> cards = a_dealer.GetHand();

            if (a_dealer.CalcScore() == g_hitLimit)
            {
                foreach (var c in cards)
                {
                    if (c.GetValue() == Card.Value.Ace)
                    {
                        return(false);
                    }
                }
            }

            return(a_dealer.CalcScore() < g_hitLimit);
        }
예제 #26
0
 public bool DoHit(model.Player a_dealer)
 {
     if (a_dealer.CalcCardValues() == g_softLimit && a_dealer.FoundAce())
     {
         return(true);
     }
     return(a_dealer.CalcScore() < g_softLimit);
 }
예제 #27
0
        //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);
        }
예제 #28
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);
        }
예제 #29
0
 public bool IsWinner(int g_maxScore, 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);
     }
     if (a_player.CalcScore() >= a_dealer.CalcScore())
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
예제 #30
0
 public bool DoHit(model.Player a_dealer)
 {
     if (a_dealer.CalcScore() < g_hitLimit || a_dealer.GotSoftSeventeen())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }