当前位置: 首页>>代码示例>>C#>>正文


C# Player.CalcScore方法代码示例

本文整理汇总了C#中Player.CalcScore方法的典型用法代码示例。如果您正苦于以下问题:C# Player.CalcScore方法的具体用法?C# Player.CalcScore怎么用?C# Player.CalcScore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.CalcScore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoHit

        public bool DoHit(Player a_dealer)
        {
            int score = 0;
            bool hasAce = false;

            IEnumerable<Card> hand = a_dealer.GetHand();

            //if the dealear has 17...
            if (a_dealer.CalcScore() == g_hitLimit)
            {
                foreach (Card c in hand)
                {
                    c.Show(true);
                    //And one of the cards is an ace (normally valued 11)
                    if (c.GetValue() == Card.Value.Ace)
                    {
                        hasAce = true;
                        break;
                    }
                }

            }
            //if hasAce is true,Ace is now valued 1     -otherwise normal value
            score = (hasAce) ? a_dealer.CalcScore() - 10 : a_dealer.CalcScore();
            return score < g_hitLimit;
        }
开发者ID:henceee,项目名称:blackjack_csharp,代码行数:26,代码来源:soft17Strategy.cs

示例2: DoHit

        public bool DoHit(Player a_dealer)
        {
            IEnumerable<Card> hand = a_dealer.GetHand();

            //if the dealear has 17...
            if (a_dealer.CalcScore() == g_hitLimit)
            {
                foreach (Card c in hand)
                {
                    c.Show(true);

                    if (c.GetValue() == Card.Value.Ace)
                    {
                         /* Since Ace is valued 11, if the
                         *  remainder of the hand equals
                         *  6, it's a soft 17, hit again.
                         */
                        if (a_dealer.CalcScore() - 11 == 6)
                        {
                            return true;
                        }
                    }
                }

            }

            return a_dealer.CalcScore() < g_hitLimit;
        }
开发者ID:henceee,项目名称:1DV607,代码行数:28,代码来源:soft17Strategy.cs

示例3: DoHit

 public bool DoHit(Player a_dealer)
 {
     if (a_dealer.CalcScore() == g_hitLimit)
     {
         return DealerHasAceInHand(a_dealer.GetHand());
     }
     return a_dealer.CalcScore() < g_hitLimit;
 }
开发者ID:ad222kr,项目名称:1dv607,代码行数:8,代码来源:SoftSeventeenHitStrategy.cs

示例4: IsDealerWinner

 public bool IsDealerWinner(Player player, Player dealer, int maxScore)
 {
     if(player.CalcScore() > maxScore)
     {
         return true;
     } else if(dealer.CalcScore() > maxScore)
     {
         return false;
     }
     return dealer.CalcScore() >= player.CalcScore();
 }
开发者ID:ss223ck,项目名称:OO_Worksshop_3,代码行数:11,代码来源:DealerWinsStrategy.cs

示例5: IfEqual

        public bool IfEqual(Player a_player, Dealer a_dealer)
        {
            const int g_hitLimit = 17;

            if (a_player.CalcScore() >= g_hitLimit && a_player.CalcScore() == a_dealer.CalcScore())
            {
                return true;
            }

            return false;
        }
开发者ID:mc22ft,项目名称:Objektorienterad-analys-och-design-med-UML,代码行数:11,代码来源:DealerWinIfEqualStratergy.cs

示例6: Win

 public bool Win(Dealer a_dealer, Player a_player, int maxScore)
 {
     if (a_player.CalcScore() > maxScore)
     {
         return true;
     }
     else if (a_dealer.CalcScore() > maxScore)
     {
         return false;
     }
     return a_player.CalcScore() >= a_dealer.CalcScore();
 }
开发者ID:jb223cp,项目名称:1dv607Workshop3,代码行数:12,代码来源:TieDealerWin.cs

示例7: winner

 public bool winner(Player a_player, Player 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());
 }
开发者ID:al222jf,项目名称:BlackJack_A_and_M,代码行数:12,代码来源:EqualScorePlayerWins.cs

示例8: IsDealerWinner

 public bool IsDealerWinner(Player m_dealer, Player m_player)
 {
     if (m_player.CalcScore() > g_maxScore)
     {
         return true;
     }
     else if (m_dealer.CalcScore() > g_maxScore)
     {
         return false;
     }
     return m_dealer.CalcScore() >= m_player.CalcScore();
 }
开发者ID:veeborn,项目名称:BlackJack,代码行数:12,代码来源:BasicWinStrategy.cs

示例9: Winner

 public bool Winner(Player a_player, Dealer a_dealer)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
         return true;
     }
     else if (a_dealer.CalcScore() > g_maxScore)
     {
         return false;
     }
     return (a_dealer.CalcScore() >= a_player.CalcScore());
 }
开发者ID:henceee,项目名称:1DV607,代码行数:12,代码来源:StandardWinRules.cs

示例10: IsDealerWinner

 public bool IsDealerWinner(Dealer a_dealer, Player a_player,int g_maxScore)
 {
     if (a_player.CalcScore() > g_maxScore)
     {
        return true;
     }
     else if (a_dealer.CalcScore() > g_maxScore)
     {
         return false;
     }
     return a_dealer.CalcScore() >= a_player.CalcScore();
 }
开发者ID:henceee,项目名称:blackjack_csharp,代码行数:12,代码来源:BasicWinStrategy.cs

示例11: IsDealerWinner

 public bool IsDealerWinner(Dealer a_dealer, Player a_player)
 {
     if (a_player.CalcScore() > a_dealer.GetMaxScore())
     {
         return true;
     }
     else if (a_dealer.CalcScore() > a_dealer.GetMaxScore())
     {
         return false;
     }
     return a_dealer.CalcScore() >= a_player.CalcScore();
 }
开发者ID:mw222rs,项目名称:blackjack_csharp,代码行数:12,代码来源:EvenDealerWinStrategy.cs

示例12: IsDealerWinner

 public bool IsDealerWinner(Player a_player, 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();
 }
开发者ID:kk222hk,项目名称:1dv607-kk222hk-Portfolio,代码行数:12,代码来源:PlayerWinsOnEqualStrategy.cs

示例13: dealerWins

 public bool dealerWins(Player a_player, Player a_dealer, int maxScore)
 {
     // if player or dealer exceeds the maxscore
     if (a_player.CalcScore() > maxScore)
     {
         return true;
     }
     else if (a_dealer.CalcScore() > maxScore)
     {
         return false;
     }
     // else favor the player
     return !(a_dealer.CalcScore() >= a_player.CalcScore());
 }
开发者ID:sk222sw,项目名称:blackjack,代码行数:14,代码来源:PlayerWinsOnEqual.cs

示例14: DoHit

        public bool DoHit(Player a_dealer)
        {
            List<Card> hand = a_dealer.GetHand().ToList();

            bool hasAce = hand.Exists(c => c.GetValue() == Card.Value.Ace);

            if (hasAce && (a_dealer.CalcScore() - 11 == 6))
            {
                return true;
            }
            else
            {
                return a_dealer.CalcScore() < g_hitLimit;
            }
        }
开发者ID:mw222rs,项目名称:blackjack_csharp,代码行数:15,代码来源:Soft17HitStrategy.cs

示例15: DoHit

        public bool DoHit(Player a_dealer)
        {
            int dealerScore = a_dealer.CalcScore();
            IEnumerable<Card> dealerCards = a_dealer.GetHand();

            // If dealers score is below 17, take a card
            if (dealerScore < g_hitLimit)
            {
                return true;
            }

            /**
            ** If dealers score is 17, check for an ace and calculate score without ace
            ** If dealer has an ace and a score of 6 without the ace, subtract 10 from score
            ** to let ace represent 1 score instead of 11, and return result
            */
            else if (dealerScore == g_hitLimit)
            {
                foreach (Card c in dealerCards)
                {
                    if ((c.GetValue() == Card.Value.Ace) && (dealerScore - 11 == 6))
                    {
                        dealerScore -= 10;
                    }
                }

                return dealerScore < g_hitLimit;
            }

            // If dealers score is above 17, don't take a card
            else
            {
                return false;
            }
        }
开发者ID:kk222hk,项目名称:1dv607-kk222hk-Portfolio,代码行数:35,代码来源:Soft17HitStrategy.cs


注:本文中的Player.CalcScore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。