Пример #1
0
        /// <summary>
        ///     Generate random hands, and write out the details of those under-ranked
        ///     by the rank predicate methods.  This would happen if one or more of the
        ///     rank predicate methods returned false negatives.
        /// </summary>
        public static void WriteErrantRandomHands(
            int numSamplesPerSimpleRank = 100,
            int numCardsDealt           = 5,
            int numCardsInFinalHand     = 5)
        {
            Ranker            ranker  = new Ranker(numCardsInFinalHand, false);
            TestHandGenerator handGen = new TestHandGenerator(0);

            foreach (SimpleRank sRank in Ranker.StandardRanks)
            {
                // Console.WriteLine();
                Console.Write("Press enter to see errant hands of type {0:s}", sRank.ToString());
                Console.Out.Flush();
                Console.ReadLine();
                for (int i = 0; i < 1000; i++)
                {
                    Hand       h = handGen.Generators[sRank](numCardsDealt, numCardsInFinalHand);
                    FullRank   fRank;
                    HandCard[] hcsRank;
                    HandCard[] hcsFill;
                    ranker.GetFullRank(h, null, out fRank, out hcsRank, out hcsFill);
                    if (fRank.SRank != sRank)
                    {
                        Console.WriteLine("Attempt to create {0:s} yielded {1:s}",
                                          sRank.ToString(), fRank.SRank.ToString());
                        Console.Write("  ");
                        Hand.WriteHandData(h, null, fRank, hcsRank, hcsFill);
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 ///     Generate random hands, and write out the details of those under-ranked
 ///     by the rank predicate methods.  This would happen if one or more of the
 ///     rank predicate methods returned false negatives.
 /// </summary>
 public static void WriteErrantRandomHands(
     int numSamplesPerSimpleRank = 100,
     int numCardsDealt = 5,
     int numCardsInFinalHand = 5)
 {
     Ranker ranker = new Ranker(numCardsInFinalHand, false);
     TestHandGenerator handGen = new TestHandGenerator(0);
     foreach (SimpleRank sRank in Ranker.StandardRanks)
     {
         // Console.WriteLine();
         Console.Write("Press enter to see errant hands of type {0:s}", sRank.ToString());
         Console.Out.Flush();
         Console.ReadLine();
         for (int i = 0; i < 1000; i++)
         {
             Hand h = handGen.Generators[sRank](numCardsDealt, numCardsInFinalHand);
             FullRank fRank;
             HandCard[] hcsRank;
             HandCard[] hcsFill;
             ranker.GetFullRank(h, null, out fRank, out hcsRank, out hcsFill);
             if (fRank.SRank != sRank)
             {
                 Console.WriteLine("Attempt to create {0:s} yielded {1:s}",
                     sRank.ToString(), fRank.SRank.ToString());
                 Console.Write("  ");
                 Hand.WriteHandData(h, null, fRank, hcsRank, hcsFill);
             }
         }
     }
 }
Пример #3
0
 public static void WriteErrantRandomHands(Ranker ranker, int numSamplesPerSimpleRank)
 {
     Console.WriteLine();
     Console.WriteLine("Press enter to display hands that might uncover rank predicate errors.");
     Console.Out.Flush();
     Console.ReadLine();
     TestHandGenerator.WriteErrantRandomHands(numSamplesPerSimpleRank, 7, 5);
 }
Пример #4
0
        public static void WriteRandomHandProfiles(
            Ranker ranker,
            int numCardsDealt           = 7,
            int numCardsInFinalHand     = 5,
            IEnumerable <Card> wilds    = null,
            int numSamplesPerSimpleRank = 10)
        {
            Console.WriteLine();
            Console.WriteLine("Press enter to write out full evaluation of random hands.");
            Console.Out.Flush();
            Console.ReadLine();

            TestHandGenerator handGen = new TestHandGenerator(0);

            foreach (SimpleRank sRank in Ranker.StandardRanks)
            {
                Console.WriteLine();
                Console.Write("Press enter to see full evaluation of hands of type {0:s}", sRank.ToString());
                Console.Out.Flush();
                Console.ReadLine();
                for (int i = 0; i < numSamplesPerSimpleRank; i++)
                {
                    Hand     h  = handGen.Generators[sRank](numCardsDealt, numCardsInFinalHand);
                    HandInfo hi = new HandInfo(h, wilds);
                    foreach (SimpleRank sRank2 in Ranker.StandardRanks)
                    {
                        FullRank   fRank;
                        HandCard[] hcsRank;
                        HandCard[] hcsFill;
                        if (ranker.RankPredicateMap[sRank2](hi, out fRank, out hcsRank, out hcsFill))
                        {
                            Console.WriteLine("Examining hand as a hand of rank {0:s}", fRank.SRank.ToString());
                            Console.Write("  ");
                            Hand.WriteHandData(h, wilds, fRank, hcsRank, hcsFill);
                        }
                    }
                }
            }
        }
Пример #5
0
        public static void WriteRandomHandProfiles(
            Ranker ranker,
            int numCardsDealt = 7,
            int numCardsInFinalHand = 5,
            IEnumerable<Card> wilds = null,
            int numSamplesPerSimpleRank = 10)
        {
            Console.WriteLine();
            Console.WriteLine("Press enter to write out full evaluation of random hands.");
            Console.Out.Flush();
            Console.ReadLine();

            TestHandGenerator handGen = new TestHandGenerator(0);
            foreach (SimpleRank sRank in Ranker.StandardRanks)
            {
                Console.WriteLine();
                Console.Write("Press enter to see full evaluation of hands of type {0:s}", sRank.ToString());
                Console.Out.Flush();
                Console.ReadLine();
                for (int i = 0; i < numSamplesPerSimpleRank; i++)
                {
                    Hand h = handGen.Generators[sRank](numCardsDealt, numCardsInFinalHand);
                    HandInfo hi = new HandInfo(h, wilds);
                    foreach (SimpleRank sRank2 in Ranker.StandardRanks)
                    {
                        FullRank fRank;
                        HandCard[] hcsRank;
                        HandCard[] hcsFill;
                        if (ranker.RankPredicateMap[sRank2](hi, out fRank, out hcsRank, out hcsFill))
                        {
                            Console.WriteLine("Examining hand as a hand of rank {0:s}", fRank.SRank.ToString());
                            Console.Write("  ");
                            Hand.WriteHandData(h, wilds, fRank, hcsRank, hcsFill);
                        }
                    }
                }
            }
        }