當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。