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


C# Hand.GetCards方法代码示例

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


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

示例1: DetermineStrongestHand

        public Hand DetermineStrongestHand(Hand handOne, Hand handTwo)
        {
            Hand bestHand = null;
            var handSize = handOne.GetCards().Count;

            handOne.ArrangeCardsHighToLow();
            handTwo.ArrangeCardsHighToLow();

            var kickerBreaker = new GroupsOfCardsOfSameValueTieBreaker(handOne, handTwo);

            bestHand = kickerBreaker.DetermineStrongestHand(1);

            for (var i = 0; i < handSize; i++)
            {
                if (handOne.GetCards()[i].GetCardValue() > handTwo.GetCards()[i].GetCardValue())
                {
                    bestHand = handOne;
                    break;
                }

                if (handTwo.GetCards()[i].GetCardValue() > handOne.GetCards()[i].GetCardValue())
                {
                    bestHand = handTwo;
                    break;
                }
            }
            return bestHand;
        }
开发者ID:rHarris213,项目名称:PokerGame,代码行数:28,代码来源:FlushTieBreaker.cs

示例2: IsAceLowStraight

 private static bool IsAceLowStraight(Hand hand)
 {
     return (hand.GetCards()[0].GetCardValue() == Value.Two
           && hand.GetCards()[1].GetCardValue() == Value.Three
           && hand.GetCards()[2].GetCardValue() == Value.Four
           && hand.GetCards()[3].GetCardValue() == Value.Five
           && hand.GetCards()[4].GetCardValue() == Value.Ace);
 }
开发者ID:rHarris213,项目名称:PokerGame,代码行数:8,代码来源:StraightTieBreaker.cs

示例3: FindHighestCard

        private Value FindHighestCard(Hand hand)
        {
            var sortedHand = hand.GetCards().OrderByDescending(c => c.GetCardValue()).ToList();

            var highestCardValue = sortedHand[0].GetCardValue();
            var secondHighestCardValue = sortedHand[1].GetCardValue();

            if (highestCardValue == Value.Ace && secondHighestCardValue == Value.Five)
            {
                highestCardValue = Value.Five;
            }

            return highestCardValue;
        }
开发者ID:rHarris213,项目名称:PokerGame,代码行数:14,代码来源:StraightFlushTieBreaker.cs

示例4: DetermineStrongestHand

        public static Hand DetermineStrongestHand(Hand handOne, Hand handTwo, int multipleRequired)
        {
            Hand bestHand = null;
            for (var cardValue = Value.Ace; cardValue >= Value.Two; cardValue--)
            {

                var handOneCountOfCard = handOne.GetCards().Count(obj => obj.GetCardValue() == cardValue);
                var handTwoCountOfCard = handTwo.GetCards().Count(obj => obj.GetCardValue() == cardValue);

                if (handOneCountOfCard == multipleRequired && handTwoCountOfCard != multipleRequired)
                {
                    bestHand = handOne;
                    break;
                }
                if (handTwoCountOfCard == multipleRequired && handOneCountOfCard != multipleRequired)
                {
                    bestHand = handTwo;
                    break;
                }

            }

            return bestHand;
        }
开发者ID:rHarris213,项目名称:PokerGame,代码行数:24,代码来源:MultiplesTieBreaker.cs


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