Esempio n. 1
0
        public void Test_GetBucket_PreflopPocket()
        {
            string    bucketCounts = "8 7 6 5";
            HsRangeCa b            = CalculateHsRangeCa(bucketCounts, new int[] { 0, 1000, 1000, 1000 }, false);

            DeckDescriptor dd = StdDeck.Descriptor;

            int[] hand;

            hand = dd.GetIndexes("7c 2d");
            Assert.AreEqual(0, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("6d 5d");
            Assert.AreEqual(1, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("Ac Ah");
            Assert.AreEqual(7, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("3d 2c");
            Assert.AreEqual(0, b.GetAbstractCard(hand, hand.Length));
        }
Esempio n. 2
0
        public void Test_GetBucket_Preview()
        {
            string    bucketCounts = "8 7 6 5";
            HsRangeCa b            = CalculateHsRangeCa(bucketCounts, new int[] { 0, 1000, 1000, 1000 }, false);

            Console.WriteLine("Bucket counts: {0}", bucketCounts);

            string[] d = new string[]
            {
                "Ac Ad",
                "Ac Kc",
                "7c 2d",
                "3c 2d",
                "Tc 9c",
                "8c 7c",
                "Ac Kc Tc Qc Jc",
                "3c 3d Ac 7d 3h",
                "7d 3d Ac 3c 3h",
                "Ad Ah Ac 7d 3h",
                "Ac Ah Qs 7d 6d",
                "5d 4d Qs 7d 6d",
                "8d 9d Qs 7d 6d",
                "Ad Ah Ac 7d 3h 5h",
                "Ad Ah Ac 7d 3h 5h 5d",
                "5c 5s Ac 7d 3h 5h 5d",
                "3c 2d Kc Td 7h",
                "3c 2d Kc Td 7h 5h Qs",
                "Js Jd 7h 8h 9h",
                "Js Jd 7h 8h 9h Jc",
                "Js Jd 7h 8h 9h 6h",
                "8c 7c",
                "8c 7c Ad Qc Jd",
                "8c 7c Ad Qc Jd 6c",
                "8c 7c Ad Qc Jd 6c 5c",
            };

            for (int i = 0; i < d.Length; ++i)
            {
                int[]  hand   = StdDeck.Descriptor.GetIndexes(d[i]);
                int    bucket = b.GetAbstractCard(hand, hand.Length);
                double hs     = HandStrength.CalculateFast(hand);
                Console.WriteLine("Hand '{0}' has strength {1:0.0000}, bucket {2}", d[i], hs, bucket);
            }
        }
Esempio n. 3
0
        public void Test_GetBucket()
        {
            string    bucketCounts = "8 7 6 5";
            HsRangeCa b            = CalculateHsRangeCa(bucketCounts, new int[] { 0, 1000, 1000, 1000 }, false);

            DeckDescriptor dd = StdDeck.Descriptor;

            int [] hand;

            // Preflop
            hand = dd.GetIndexes("Ac Ah");
            Assert.AreEqual(7, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("7c 2d");
            Assert.AreEqual(0, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("3d 2c");
            Assert.AreEqual(0, b.GetAbstractCard(hand, hand.Length));

            // Flop
            hand = dd.GetIndexes("Ac Ah As Ad 2h");
            Assert.AreEqual(6, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("2c 3d As Ks Qh");
            Assert.AreEqual(0, b.GetAbstractCard(hand, hand.Length));

            // Turn
            hand = dd.GetIndexes("Ac Ah As Ad 2h 2d");
            Assert.AreEqual(5, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("6c 7c 3c 4c 5c As");
            Assert.AreEqual(5, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("2c 3d As Ks Qh 9d");
            Assert.AreEqual(0, b.GetAbstractCard(hand, hand.Length));

            // River
            hand = dd.GetIndexes("Ac Ah As Ad 2h 2d Qh");
            Assert.AreEqual(4, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("6c 7c 8d 4c 5c As 8c");
            Assert.AreEqual(4, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("2c 3d As Ks Qh 9d 6h");
            Assert.AreEqual(0, b.GetAbstractCard(hand, hand.Length));

            // Runner - runner
            hand = dd.GetIndexes("8c 7c");
            Assert.AreEqual(2, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("8c 7c Ad Qc Jd");
            Assert.AreEqual(0, b.GetAbstractCard(hand, hand.Length));
            hand = dd.GetIndexes("8c 7c Ad Qc Jd 4c");
            int abstrCard = b.GetAbstractCard(hand, hand.Length);

            Assert.IsTrue(0 < abstrCard && abstrCard < 5, "Not worst, not best");
            hand = dd.GetIndexes("8c 7c Ad Qc Jd 4c 5c");
            Assert.AreEqual(4, b.GetAbstractCard(hand, hand.Length));
        }