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


C# Models.Hand类代码示例

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


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

示例1: Main

        internal static void Main()
        {
            ICard card = new Card(CardFace.Ace, CardSuit.Clubs);
            Console.WriteLine(card);

            IHand hand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Spades),
                new Card(CardFace.Nine, CardSuit.Clubs),
                new Card(CardFace.Nine, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
            });
            Console.WriteLine(hand);

            IHand otherHand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Six, CardSuit.Hearts),
                new Card(CardFace.Six, CardSuit.Spades),
                new Card(CardFace.Three, CardSuit.Hearts),
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Clubs),
            });
            Console.WriteLine(otherHand);

            IPokerHandsChecker checker = new PokerHandsChecker();
            Console.WriteLine(checker.IsStraightFlush(hand));
            Console.WriteLine(checker.IsStraight(hand));
            Console.WriteLine(checker.IsThreeOfAKind(hand));
            Console.WriteLine(checker.IsFlush(hand));
            Console.WriteLine(checker.IsOnePair(hand));
            Console.WriteLine(checker.IsTwoPair(hand));

            Console.WriteLine(checker.CompareHands(hand, otherHand));
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:35,代码来源:PokerExample.cs

示例2: TestOnHandWithNoCards

        public void TestOnHandWithNoCards()
        {
            var handWithNoCards = new Hand(new List<ICard>());
            var expected = false;
            var actual = this.pokerHandsChecker.IsOnePair(handWithNoCards);

            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:8,代码来源:IsOnePairMethod.cs

示例3: ToStringHandWithNoCards

        public void ToStringHandWithNoCards()
        {
            var emptyHand = new Hand(new List<ICard>());
            var expected = string.Empty;
            var actual = emptyHand.ToString();

            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:8,代码来源:HandToString.cs

示例4: TestInitializeHand

        public void TestInitializeHand()
        {
            this.hand = new Hand();
            this.mockedImageOfCard = new Bitmap(4, 4);
            this.board = new Card[5];

            Assert.IsNotNull(board, "board should not be null!");
            Assert.IsNotNull(hand, "mockedImageOfCard should not be null!");
            Assert.IsNotNull(hand, "hand should not be null!");
        }
开发者ID:TeamClementineSoftuni,项目名称:Poker,代码行数:10,代码来源:HandEvaluatorTest.cs

示例5: ToStringHandWithOneCardTenOfClubs

        public void ToStringHandWithOneCardTenOfClubs()
        {
            var handWithOneCardTenOfClubs = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ten, CardSuit.Clubs)
            });

            var expected = "10♣";
            var actual = handWithOneCardTenOfClubs.ToString();
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:11,代码来源:HandToString.cs

示例6: ToStringHandWithSameCards

        public void ToStringHandWithSameCards()
        {
            var handWithFiveCards = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ace, CardSuit.Hearts),
                new Card(CardFace.Ace, CardSuit.Hearts),
                new Card(CardFace.Ace, CardSuit.Hearts),
                new Card(CardFace.Ace, CardSuit.Hearts)
            });

            var expected = "A♥ A♥ A♥ A♥";
            var actual = handWithFiveCards.ToString();
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:14,代码来源:HandToString.cs

示例7: TestOnHandWithFourDifferentCardsOnEqualSuit

        public void TestOnHandWithFourDifferentCardsOnEqualSuit()
        {
            var handWithFiveDifferentCardsOnEqualSuit = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ten, CardSuit.Diamonds),
                new Card(CardFace.Seven, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Eight, CardSuit.Diamonds)
            });

            var expected = false;
            var actual = this.pokerHandsChecker.IsOnePair(handWithFiveDifferentCardsOnEqualSuit);
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:14,代码来源:IsOnePairMethod.cs

示例8: TestOnHandWithValidFullHouse

        public void TestOnHandWithValidFullHouse()
        {
            var handWithFiveDifferentCardsOnEqualSuit = new Hand(new List<ICard>()
            {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Six, CardSuit.Diamonds),
                new Card(CardFace.Six, CardSuit.Hearts),
                new Card(CardFace.Ace, CardSuit.Spades),
                new Card(CardFace.Ace, CardSuit.Clubs),
            });

            var expected = false;
            var actual = this.pokerHandsChecker.IsOnePair(handWithFiveDifferentCardsOnEqualSuit);
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:15,代码来源:IsOnePairMethod.cs

示例9: TestOnHandWithThreeEqualOnSuitOfFiveCards

        public void TestOnHandWithThreeEqualOnSuitOfFiveCards()
        {
            var handWithFiveDifferentCardsOnEqualSuit = new Hand(new List<ICard>()
            {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Diamonds),
                new Card(CardFace.Ace, CardSuit.Clubs),
            });

            var expected = false;
            var actual = this.pokerHandsChecker.IsOnePair(handWithFiveDifferentCardsOnEqualSuit);
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:15,代码来源:IsOnePairMethod.cs

示例10: ToStringHandWithFiveCards

        public void ToStringHandWithFiveCards()
        {
            var handWithFiveCards = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Diamonds),
                new Card(CardFace.Ace, CardSuit.Hearts),
                new Card(CardFace.Two, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Diamonds)
            });

            var expected = "10♣ 7♦ A♥ 2♠ 8♦";
            var actual = handWithFiveCards.ToString();
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:15,代码来源:HandToString.cs

示例11: TestOnHandWithTwoEqualCards

        public void TestOnHandWithTwoEqualCards()
        {
            var handWithTwoEqualCard = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Ace, CardSuit.Hearts),
                new Card(CardFace.Two, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Diamonds)
            });

            var expected = false;
            var actual = this.pokerHandsChecker.IsValidHand(handWithTwoEqualCard);
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:15,代码来源:IsValidHandMethod.cs

示例12: Hand

        public void TestOnTwoPairАgainstLowerTwoPair()
        {
            var handWithUpperTwoPair = new Hand(new List<ICard>()
            {
                new Card(CardFace.Four, CardSuit.Spades),
                new Card(CardFace.Four, CardSuit.Clubs),
                new Card(CardFace.Three, CardSuit.Spades),
                new Card(CardFace.Three, CardSuit.Hearts),
                new Card(CardFace.King, CardSuit.Diamonds)
            });

            var handWithLowerTwoPair = new Hand(new List<ICard>()
            {
                new Card(CardFace.Four, CardSuit.Hearts),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Three, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Spades)
            });

            var actual = this.pokerHandsChecker.CompareHands(handWithUpperTwoPair, handWithLowerTwoPair);
            Assert.AreEqual(LeftIsBigger, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:23,代码来源:CompareHandsMethod.cs

示例13: TestOnHandWithHighCard_2

        public void TestOnHandWithHighCard_2()
        {
            var handWithFiveDifferentCardsOnEqualSuit = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Jack, CardSuit.Diamonds),
                new Card(CardFace.Seven, CardSuit.Hearts),
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.Ace, CardSuit.Clubs)
            });

            var expected = false;
            var actual = this.pokerHandsChecker.IsOnePair(handWithFiveDifferentCardsOnEqualSuit);
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:15,代码来源:IsOnePairMethod.cs

示例14: TestOnHandWithValidStraight_2

        public void TestOnHandWithValidStraight_2()
        {
            var handWithFiveDifferentCardsOnEqualSuit = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Three, CardSuit.Hearts),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Clubs)
            });

            var expected = false;
            var actual = this.pokerHandsChecker.IsOnePair(handWithFiveDifferentCardsOnEqualSuit);
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:15,代码来源:IsOnePairMethod.cs

示例15: TestOnHandWithTwoEqualOfSixCardsOnEqualSuit

        public void TestOnHandWithTwoEqualOfSixCardsOnEqualSuit()
        {
            var handWithTwoEqualOfSixCardsOnEqualSuit = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Seven, CardSuit.Clubs),
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Clubs),
                new Card(CardFace.Eight, CardSuit.Clubs)
            });

            var expected = false;
            var actual = this.pokerHandsChecker.IsOnePair(handWithTwoEqualOfSixCardsOnEqualSuit);
            Assert.AreEqual(expected, actual);
        }
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:16,代码来源:IsOnePairMethod.cs


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