コード例 #1
0
        private static void ShowHands(IChanceAbstraction ca)
        {
            if (_cmdLine.Hands == null)
            {
                return;
            }

            foreach (string handS in _cmdLine.Hands)
            {
                handS.Trim();
                if (handS.Length % 2 != 0)
                {
                    Console.WriteLine("Wrong HE hand: {0}", handS);
                    continue;
                }
                string cards = "";
                for (int i = 0; i < handS.Length; i += 2)
                {
                    cards += handS.Substring(i, 2) + " ";
                }
                int[] hand = null;
                try
                {
                    hand = StdDeck.Descriptor.GetIndexes(cards);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Wrong HE hand: {0}, {1}", cards, e.ToString());
                    continue;
                }
                int round = HeHelper.HandSizeToRound[hand.Length];
                if (round == -1)
                {
                    Console.WriteLine("Wrong HE hand size: {0}", handS);
                    continue;
                }
                Console.Write("Abstract cards for hand {0}:", StdDeck.Descriptor.GetCardNames(hand));
                for (int r = 0; r <= round; ++r)
                {
                    int abstrCard = ca.GetAbstractCard(hand, HeHelper.RoundToHandSize[r]);
                    Console.Write(" {0}", abstrCard);
                }
                Console.WriteLine();
            }
        }
コード例 #2
0
        public static void PrintPreflopRanges(IChanceAbstraction ca)
        {
            List <HePocketKind>[] abstrRanges = new List <HePocketKind> [0];
            int[] abstrRangesSizes            = new int[0];

            for (int p = 0; p < (int)HePocketKind.__Count; ++p)
            {
                HePocketKind kind      = (HePocketKind)p;
                CardSet      pocketCS  = HePocket.KindToCardSet(kind);
                int []       pocketArr = StdDeck.Descriptor.GetIndexesAscending(pocketCS).ToArray();
                int          abstrCard = ca.GetAbstractCard(pocketArr, pocketArr.Length);

                if (abstrCard >= abstrRanges.Length)
                {
                    Array.Resize(ref abstrRanges, abstrCard + 1);
                    Array.Resize(ref abstrRangesSizes, abstrCard + 1);
                }
                if (abstrRanges[abstrCard] == null)
                {
                    abstrRanges[abstrCard] = new List <HePocketKind>();
                }

                abstrRanges[abstrCard].Add(kind);
                abstrRangesSizes[abstrCard] += HePocket.KindToRange(kind).Length;
            }

            Console.WriteLine("Preflop ranges of CA: {0}", ca.Name);
            int total = 0;

            for (int i = abstrRanges.Length - 1; i >= 0; --i)
            {
                Console.Write("{0,2} ({1,4}):", i, abstrRangesSizes[i]);
                foreach (HePocketKind k in abstrRanges[i])
                {
                    Console.Write(" {0}", HePocket.KindToString(k));
                }
                Console.WriteLine();
                total += abstrRangesSizes[i];
            }
            Console.WriteLine("Total: {0}", total);
        }