예제 #1
0
        public HoleCards(Card.Rank rank1, Card.Suite suite1, Card.Rank rank2, Card.Suite suite2)
        {
            Card0 = new Card(suite1, rank1);
            Card1 = new Card(suite2, rank2);

            SortCards();
        }
예제 #2
0
        private static int AddToData(System.IO.StreamWriter file, HoleCards hand1, HoleCards hand2, float equity)
        {
            int total = 0;

            for (Card.Suite s11 = Card.Suite.Clubs; s11 <= Card.Suite.Spades; s11++)
            {
                for (Card.Suite s12 = Card.Suite.Clubs; s12 <= Card.Suite.Spades; s12++)
                {
                    if (!DoSuitsAgree(hand1.Card1.suite, hand1.Card0.suite, s12, s11))
                    {
                        continue;
                    }

                    for (Card.Suite s21 = Card.Suite.Clubs; s21 <= Card.Suite.Spades; s21++)
                    {
                        if (!DoSuitsAgree(hand2.Card0.suite, hand1.Card0.suite, s21, s11))
                        {
                            continue;
                        }

                        if (!DoSuitsAgree(hand2.Card0.suite, hand1.Card1.suite, s21, s12))
                        {
                            continue;
                        }

                        for (Card.Suite s22 = Card.Suite.Clubs; s22 <= Card.Suite.Spades; s22++)
                        {
                            if (!DoSuitsAgree(hand2.Card1.suite, hand1.Card0.suite, s22, s11))
                            {
                                continue;
                            }

                            if (!DoSuitsAgree(hand2.Card1.suite, hand1.Card1.suite, s22, s12))
                            {
                                continue;
                            }

                            if (!DoSuitsAgree(hand2.Card1.suite, hand2.Card0.suite, s22, s21))
                            {
                                continue;
                            }

                            HoleCards hand1_new = new HoleCards(hand1.Card0.rank, s11, hand1.Card1.rank, s12);
                            HoleCards hand2_new = new HoleCards(hand2.Card0.rank, s21, hand2.Card1.rank, s22);

                            total += AddToDataTmp(file, hand1_new, hand2_new, equity);
                            total += AddToDataTmp(file, hand2_new, hand1_new, 1.0f - equity);
                        }
                    }
                }
            }

            return(total);
        }
예제 #3
0
        /// <summary>
        /// Board and hand are expected to be sorted
        /// </summary>
        private static int GetFlushRank(HoleCards heroHoleCards, Card[] sortedBoard, Card.Suite suite)
        {
            Card[] allCards = new Card[7];

            InsertSortedHoleCardsToSortedBoard(allCards, heroHoleCards, sortedBoard);

            int sum    = 0;
            int weight = 15 * 15 * 15 * 15;

            for (int n = 5, k = 0; n > 0; k++)
            {
                if (allCards[k].suite == suite)
                {
                    sum    += weight * (int)allCards[k].rank;
                    weight /= 15;
                    n--;
                }
            }

            return(sum);
        }
예제 #4
0
 private static bool DoSuitsAgree(Card.Suite s1_old, Card.Suite s2_old, Card.Suite s1_new, Card.Suite s2_new)
 {
     return((s1_old == s2_old && s1_new == s2_new) || (s1_old != s2_old && s1_new != s2_new));
 }