Example #1
0
        public static TwoPlayerEquity RangeVsRange(Range r1, Range r2)
        {
            TwoPlayerEquity res;

            res.win1 = 0.0; res.win2 = 0.0; res.draw = 0.0;
            double totalCombos = 0.0;

            for (int i = 0; i < 169; i++)
            {
                if (r1.probability[i] < epsilon)
                {
                    continue;
                }
                for (int j = 0; j < 169; j++)
                {
                    if (r2.probability[j] < epsilon)
                    {
                        continue;
                    }
                    Hand            h1     = HandPool.getHand(i);
                    Hand            h2     = HandPool.getHand(j);
                    TwoPlayerEquity temp   = HandVsHand(h1, h2);
                    double          weight = HandCombos.get(i, j) * r1.probability[i] * r2.probability[j];
                    res.win1    += temp.win1 * weight;
                    res.win2    += temp.win2 * weight;
                    res.draw    += temp.draw * weight;
                    totalCombos += weight;
                }
            }
            res.win1 /= totalCombos;
            res.win2 /= totalCombos;
            res.draw /= totalCombos;

            return(res);
        }
Example #2
0
        public static TwoPlayerEquity getEquity(Hand h1, Hand h2)
        {
            if (h1.getValue() <= h2.getValue())
            {
                return(twoPlayerEquities[h1.getValue()][h2.getValue() - h1.getValue()]);
            }
            TwoPlayerEquity res = twoPlayerEquities[h2.getValue()][h1.getValue() - h2.getValue()];
            double          t   = res.win1; res.win1 = res.win2; res.win2 = t;

            return(res);
        }
Example #3
0
        public static TwoPlayerEquity getEquity(int h1, int h2)
        {
            if (h1 <= h2)
            {
                return(twoPlayerEquities[h1][h2 - h1]);
            }
            TwoPlayerEquity res = twoPlayerEquities[h2][h1 - h2];
            double          t   = res.win1; res.win1 = res.win2; res.win2 = t;

            return(res);
        }
Example #4
0
 public EquityPool()
 {
     twoPlayerEquities = new TwoPlayerEquity[169][];
     for (int i = 0; i < 169; i++)
     {
         twoPlayerEquities[i] = new TwoPlayerEquity[169 - i];
         for (int j = 0; j < 169 - i; j++)
         {
             String equities = getEquitiesString(i, i + j);
             twoPlayerEquities[i][j] = EquitiesFromString(equities);
         }
     }
 }
        private static void Iteration(Range oppRange, List <int> stacks, List <int> blinds, int pos, double EVFold, int handNum, out float res)
        {
            if (pos == 0) // sb
            {
                double          oppCalls   = HandCombos.RangeProbabilityKnowingHand(handNum, oppRange);
                TwoPlayerEquity pushEquity = Equities.HandVsRange(HandPool.getHand(handNum), oppRange);
                double          EVPush     = (1 - oppCalls) * (stacks[0] + Math.Min(stacks[1], blinds[1]))
                                             + oppCalls * (pushEquity.win1 * (stacks[0] + effStack) + pushEquity.draw * (stacks[0]) + pushEquity.win2 * (stacks[0] - effStack));
                if (isAnte)
                {
                    EVPush += (1 - oppCalls) * blinds[2];
                }

                if (EVPush > EVFold)
                {
                    res = 1.0f;
                }
                else
                {
                    res = 0.0f;
                }
            }
            else // bb
            {
                TwoPlayerEquity callEquity = Equities.HandVsRange(HandPool.getHand(handNum), oppRange);
                double          EVCall     = callEquity.win1 * (stacks[0] + effStack) + callEquity.draw * (stacks[0]);

                if (EVCall > EVFold)
                {
                    res = 1.0f;
                }
                else
                {
                    res = 0.0f;
                }
            }
        }