示例#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);
        }
示例#2
0
        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;
                }
            }
        }