Exemplo n.º 1
0
        static void Main(string[] args)
        {
            PokerHand royalFlush        = new PokerHand("QD TD AD KD JD");
            PokerHand straightFlush     = new PokerHand("4D 5D 6D 7D 8D");
            PokerHand Kind4             = new PokerHand("4D 4H 4C 4S 8D");
            PokerHand strongerKind4     = new PokerHand("AC AS AD AH 9D");
            PokerHand fullHouse         = new PokerHand("4D 4H 4C 5H 5S");
            PokerHand strongerFullHouse = new PokerHand("6H 6C 6S TH TS");
            PokerHand flush             = new PokerHand("4H 7H 5H 8H TH");
            PokerHand straight          = new PokerHand("5C 6H 7S 8D 9C");
            PokerHand Kind3             = new PokerHand("4D 4H 4S 8S 9C");
            PokerHand twoPair           = new PokerHand("4D 4S 6H 6S 8C");
            PokerHand pair    = new PokerHand("4H 2C 8D 9H 8H");
            PokerHand High9   = new PokerHand("4H 5C 2D 7D 9H");
            PokerHand HighAce = new PokerHand("6H AS QD 9H 2C");



            // same values bar suit for real match tie
            PokerHand sameTwoPair = new PokerHand("4H 4C 8S 6D 6C");
            PokerHand sameHighAce = new PokerHand("2D 6H 4S TC AD");

            // win/lose situations
            Console.WriteLine(royalFlush.CompareWith(twoPair));
            Console.WriteLine(Kind3.CompareWith(fullHouse));

            //same ranking, but win/lose situation still occurs due to value ranking
            Console.WriteLine(fullHouse.CompareWith(strongerFullHouse));
            Console.WriteLine(strongerKind4.CompareWith(Kind4));

            //tie situations
            Console.WriteLine(HighAce.CompareWith(sameHighAce));
            Console.WriteLine(twoPair.CompareWith(sameTwoPair));
        }
Exemplo n.º 2
0
        public void BreakATieFullHouseIWin()
        {
            PokerHand player1 = new PokerHand("2H 2S 6C 6H 6D");
            PokerHand player2 = new PokerHand("2C 2D 5D 5S 5C");

            Assert.AreEqual(Result.Win, player1.CompareWith(player2));
        }
Exemplo n.º 3
0
        public void BreakATieFourOfAKindIWin()
        {
            PokerHand player1 = new PokerHand("2H 6S 6C 6H 6D");
            PokerHand player2 = new PokerHand("2C 5H 5D 5S 5C");

            Assert.AreEqual(Result.Win, player1.CompareWith(player2));
        }
Exemplo n.º 4
0
        public void BreakATiePairTheyWin()
        {
            PokerHand player1 = new PokerHand("2C 7D 5D 5S 4C");
            PokerHand player2 = new PokerHand("2H 4S 6C 6H TH");

            Assert.AreEqual(Result.Loss, player1.CompareWith(player2));
        }
Exemplo n.º 5
0
        public void BreakATiePairHighCard()
        {
            PokerHand player1 = new PokerHand("2H 4S 6C 6H TH");
            PokerHand player2 = new PokerHand("2C 3D 6D 6S 4C");

            Assert.AreEqual(Result.Win, player1.CompareWith(player2));
        }
Exemplo n.º 6
0
        public void BreakATieTwoPairIWin()
        {
            PokerHand player1 = new PokerHand("2H 2S 6C 6H TH");
            PokerHand player2 = new PokerHand("2C 2D 5D 5S 4C");

            Assert.AreEqual(Result.Win, player1.CompareWith(player2));
        }
Exemplo n.º 7
0
        public void BreakATieTwoPairTheyWin()
        {
            PokerHand player1 = new PokerHand("2H 2S 5C 5H TH");
            PokerHand player2 = new PokerHand("2C 2D 6D 6S 4C");

            Assert.AreEqual(Result.Loss, player1.CompareWith(player2));
        }
Exemplo n.º 8
0
        public void BreakATieFlushTheyWin()
        {
            PokerHand player1 = new PokerHand("2H 4H 6H 8H 9H");
            PokerHand player2 = new PokerHand("2C 3C 5C 6C TC");

            Assert.AreEqual(Result.Loss, player1.CompareWith(player2));
        }
Exemplo n.º 9
0
        public void CantBreakATieFlush()
        {
            PokerHand player1 = new PokerHand("2H 4H 6H 8H TH");
            PokerHand player2 = new PokerHand("2C 3C 5C 6C TC");

            Assert.AreEqual(Result.Tie, player1.CompareWith(player2));
        }
Exemplo n.º 10
0
        public void CantBreakATieHighCard()
        {
            PokerHand player1 = new PokerHand("2S 4H 6H 8D 9S");
            PokerHand player2 = new PokerHand("2C 3D 5C 6S 9H");

            Assert.AreEqual(Result.Tie, player1.CompareWith(player2));
        }
Exemplo n.º 11
0
        public void BreakATieFlushIWin()
        {
            PokerHand player1 = new PokerHand("2H 4H 6H 8H TH");
            PokerHand player2 = new PokerHand("2C 3C 5C 6C 7C");

            Assert.AreEqual(Result.Win, player1.CompareWith(player2));
        }
Exemplo n.º 12
0
        public void BreakATieHighCardTheyWin()
        {
            PokerHand player1 = new PokerHand("2S 4H 6H 8D 9S");
            PokerHand player2 = new PokerHand("2C 3D 5C 6S TH");

            Assert.AreEqual(Result.Loss, player1.CompareWith(player2));
        }
Exemplo n.º 13
0
        public void BreakATieHighCardIWin()
        {
            PokerHand player1 = new PokerHand("2S 4H 6H 8D TS");
            PokerHand player2 = new PokerHand("2C 3D 5C 6S 7H");

            Assert.AreEqual(Result.Win, player1.CompareWith(player2));
        }
Exemplo n.º 14
0
        public void DetectATie()
        {
            PokerHand player1 = new PokerHand("2S 2H 6H 8D TS");
            PokerHand player2 = new PokerHand("2C 2D 6C 8S TH");

            Assert.AreEqual(Result.Tie, player1.CompareWith(player2));
        }
Exemplo n.º 15
0
        public void DetectALoss()
        {
            PokerHand player1 = new PokerHand("2S 2H 6C 8D TS");
            PokerHand player2 = new PokerHand("4S 4H 4C 8S TH");

            Assert.AreEqual(Result.Loss, player1.CompareWith(player2));
        }
Exemplo n.º 16
0
        public void DetectAWinner()
        {
            PokerHand player1 = new PokerHand("2S 2H 6C 8D TS");
            PokerHand player2 = new PokerHand("4S 7H 6C 8D TS");

            Assert.AreEqual(Result.Win, player1.CompareWith(player2));
        }