Example #1
0
        public void IsFlush_NotFlush_False()
        {
            SolverPrototype      solver = new SolverPrototype("Deck1");
            HandFourOfAKind_Stub stub   = new HandFourOfAKind_Stub();
            bool expected = false;

            bool actual = solver.IsFlush(stub);

            Assert.That(actual, Is.EqualTo(expected));
        }
Example #2
0
        public void IsTwoPairs_OnePair_True()
        {
            SolverPrototype   solver = new SolverPrototype("Deck1");
            HandOnePairs_Stub hand   = new HandOnePairs_Stub();
            bool expected            = true;

            bool actual = solver.IsPair(hand);

            Assert.That(actual, Is.EqualTo(expected));
        }
Example #3
0
        public void IsFourOfAKind_FourOfAKind_true()
        {
            SolverPrototype      solver = new SolverPrototype("Deck1");
            HandFourOfAKind_Stub stub   = new HandFourOfAKind_Stub();
            bool expected = true;

            bool actual = solver.IsFourOfAKind(stub);

            Assert.That(actual, Is.EqualTo(expected));
        }
Example #4
0
        public void IsFlush_Flush_True()
        {
            SolverPrototype solver   = new SolverPrototype("Deck1");
            HandFlush_Stub  stub     = new HandFlush_Stub();
            bool            expected = true;

            bool actual = solver.IsFlush(stub);

            Assert.That(actual, Is.EqualTo(expected));
        }
Example #5
0
        public static void TestMain2()
        {
            List<int> handTypeCounts = new List<int>() { 0, 0, 0, 0, 0, 0, 0, 0 };

            SolverPrototype solver = new SolverPrototype("Deck1");

            Console.WriteLine("Player 1 hand: {0}, Highest ranked: {1}",
                solver.Player1Hand.PokerHand.ToString(), solver.Player1Hand.PokerHandRanks[0].ToString());

            Console.WriteLine("Player 2 hand: {0}, Highest ranked: {1}",
                solver.Player2Hand.PokerHand.ToString(), solver.Player2Hand.PokerHandRanks[0].ToString());

            Console.WriteLine("Player " + (solver.Evaluate() + 1) + " has won!");

            for (int i = 0; i < 1000; i++)
            {
                while (solver.Deck.Cards.Count >= 8)
                {
                    Console.WriteLine("--------");
                    Console.WriteLine("New Game");

                    solver.Player1Hand.DrawNewHand(solver.Deck);
                    solver.Player2Hand.DrawNewHand(solver.Deck);

                    Console.WriteLine("Player 1 hand: {0}, Highest ranked: {1}",
                    solver.Player1Hand.PokerHand.ToString(), solver.Player1Hand.PokerHandRanks[0].ToString());
                    handTypeCounts[(int)solver.Player1Hand.PokerHand] += 1;

                    Console.WriteLine("Player 2 hand: {0}, Highest ranked: {1}",
                        solver.Player2Hand.PokerHand.ToString(), solver.Player2Hand.PokerHandRanks[0].ToString());
                    handTypeCounts[(int)solver.Player1Hand.PokerHand] += 1;

                    Console.WriteLine("Player " + (solver.Evaluate() + 1) + " has won!");
                }

                solver.Deck.ReshuffleDeck();
                Console.WriteLine("Reshuffled deck");
            }

            Console.WriteLine("----------Total Hand counts--------------");
            Console.WriteLine("Striaght Flush: {0}, Four of a kind: {1}, Fullhouse: {2}, Flush: {3}, Straight: {4}, Two Pair: {5}, Pair: {6}, High: {7}",
                handTypeCounts[7], handTypeCounts[6], handTypeCounts[5], handTypeCounts[4], handTypeCounts[3], handTypeCounts[2], handTypeCounts[1], handTypeCounts[0]);
        }
Example #6
0
 public SolverPrototypeService(SolverPrototype solver)
 {
 }
Example #7
0
        public void IsTwoPairs_TwoPairs_True()
        {
            SolverPrototype solver = new SolverPrototype("Deck1");
            HandTwoPairs_Stub hand = new HandTwoPairs_Stub();
            bool expected = true;

            bool actual = solver.IsTwoPairs(hand);
            Assert.That(actual, Is.EqualTo(expected));
        }
Example #8
0
        public void IsFullHouse_FullHouse_True()
        {
            SolverPrototype solver = new SolverPrototype("Deck1");
            HandFullHouse_Stub stub = new HandFullHouse_Stub();
            bool expected = true;

            bool actual = solver.IsFullHouse(stub);
            Assert.That(actual, Is.EqualTo(expected));
        }
Example #9
0
        public void IsFourOfAKind_FourOfAKind_true()
        {
            SolverPrototype solver = new SolverPrototype("Deck1");
            HandFourOfAKind_Stub stub = new HandFourOfAKind_Stub();
            bool expected = true;

            bool actual = solver.IsFourOfAKind(stub);
            Assert.That(actual, Is.EqualTo(expected));
        }
Example #10
0
        public void IsFlush_NotFlush_False()
        {
            SolverPrototype solver = new SolverPrototype("Deck1");
            HandFourOfAKind_Stub stub = new HandFourOfAKind_Stub();
            bool expected = false;

            bool actual = solver.IsFlush(stub);
            Assert.That(actual, Is.EqualTo(expected));
        }
Example #11
0
 public SolverPrototypeService(SolverPrototype solver)
 {
 }