Open Side Menu Go to the Top
Register
Help Calculating Tie %? Help Calculating Tie %?

05-10-2011 , 07:58 PM
I'm trying to use keith rule's C# poker eval code, but it appears there is an error in the way the ties are calculated for 3+ players which I am trying to amend.

Can someone explain to me how the equity% is calculated from the wins & tie numbers from ppt?

I am able to get the win% just fine, as well as the tie numbers that are below, but can't figure out how to get the correct equity or tie% from those.

Hold'em Simulation ?
1,086,008 trials (Exhaustive)
Hand Equity Wins Ties
asks 31.19% 96,165 501,234
ackd 24.88% 27,648 501,234
5h4h 29.72% 309,270 29,523
ah5d 14.20% 127,062 70,445

Pokerstove output for reference (same equity, different tie numbers) I need to know how these tie numbers are calculated

1,086,008 games 0.002 secs 543,004,000 games/sec

Board:
Dead:

equity win tie pots won pots tied
Hand 0: 31.191% 08.85% 22.34% 96165 242573.17 { AsKs }
Hand 1: 24.882% 02.55% 22.34% 27648 242573.17 { AcKd }
Hand 2: 29.724% 28.48% 01.25% 309270 13538.00 { 5h4h }
Hand 3: 14.203% 11.70% 02.50% 127062 27178.67 { Ah5d }
Help Calculating Tie %? Quote
05-10-2011 , 08:21 PM
They are the same. To get total equity for 3 hands you use:

(won hands + 1/3 3-way-tied hands + 1/2 2-way tied hands) / total hands

Poker stove doesn't show the total tied hand count by each hand, it shows the fractional tie count, i.e. the amount to add to your win equity.

For your ties, you will need to know if it was a 2-way or 3-way tie to calculate the equity. If that is problematic with the code you are using, just assume all 2-say since 3-way is rare. If the code is like most hand evaluators, it won't be hard to do as each hand will have a numeric value.

Last edited by spadebidder; 05-10-2011 at 08:28 PM.
Help Calculating Tie %? Quote
05-11-2011 , 09:22 AM
won't there be some 4 way ties too when the board makes the best possible hand (like QhJhTh9h8h in this example)?
Help Calculating Tie %? Quote
05-11-2011 , 09:27 AM
Yes, the ties column shows this as they are all non zero values
Help Calculating Tie %? Quote
05-11-2011 , 02:00 PM
So is there any way to convert the total tied count by each hand to the fractional tie count without knowing if each tie was 2,3 or 4 way? Or some way to figure this out given the ppt numbers?
Help Calculating Tie %? Quote
05-11-2011 , 02:07 PM
Quote:
Originally Posted by andr3w321
So is there any way to convert the total tied count by each hand to the fractional tie count without knowing if each tie was 2,3 or 4 way? Or some way to figure this out given the ppt numbers?
From only the output you show above, no. But the counts are in the code or it couldn't calculate the total. Examine the source code and then just modify the output to show the breakdown.
Help Calculating Tie %? Quote
05-13-2011 , 05:13 PM
I think his method of finding the ties is fundamentally flawed as he calculates the number of ties the best hand has with the other hands. I was able to write some code that used the output from the wins and losses to convert the ties array to the correct #s for 3 way hands, but it breaks down at 4+ hands. I was hoping to adapt this, but from your last post this is impossible and I have to start over. I'm happy to post this code, but its pretty useless I guess.

Back to the root of the problem...help a brother out?

Code:
            // Iterate through all board possiblities that doesn't include any pocket cards.
            foreach (ulong boardhand in Hands(boardmask, deadcards_mask, 5))
            {
                // Evaluate all hands and determine the best hand
                ulong bestpocket = Evaluate(pocketmasks[0] | boardhand, 7);
                pockethands[0] = bestpocket;
                bestcount = 1;
                for (int i = 1; i < pockets.Length; i++)
                {
                    pockethands[i] = Evaluate(pocketmasks[i] | boardhand, 7);
                    if (pockethands[i] > bestpocket)
                    {
                        bestpocket = pockethands[i];
                        bestcount = 1;
                    }
                    else if (pockethands[i] == bestpocket)
                    {
                        bestcount++;
                    }
                }

                // Calculate wins/ties/loses for each pocket + board combination.
                for (int i = 0; i < pockets.Length; i++)
                {
                    if (pockethands[i] == bestpocket)
                    {
                        if (bestcount > 1)
                        {
                            ties[i]++;
                        }
                        else
                        {
                            wins[i]++;
                        }
                    }
                    else if (pockethands[i] < bestpocket)
                    {
                        losses[i]++;
                    }
                }

                totalHands++;
            }
Help Calculating Tie %? Quote
05-13-2011 , 05:24 PM
Useless code that works for 2 or 3 players, breaks down for 4+. IGNORE THIS CODE IF YOU WANT TO HELP ME OUT. Thanks!

Code:
                //set ties              
                for (int i = 0; i < count; i++)
                {
                    ties[i] = (totalhands - wins[i] - losses[i]);
                }
                //calc ties
                long[] newties = new long[count];
                Array.Copy(ties, newties, count);
                Array.Sort(newties);
                long small = newties[0];
                long diff = 0;

                for (int i = 0; i < count; i++)
                {
                    if (newties[i] != small)
                    {
                        small = newties[i];
                        diff = newties[i-1];
                    }
                    for (int j = 0; j < count; j++)
                    {
                        if (ties[j] == small)
                        {
                            ties[j] = (ties[j] - diff) / (count - i);
                            newties[i] = ties[j];
                        }
                    }                    
                }
Help Calculating Tie %? Quote
05-18-2011 , 09:39 PM
I think this is the relevant poker eval code. I removed most of the low calcs as it's irrelevant to me. Can anyone help me out here to see how my code is different?

bestcount is the same as hishare
bestpocket is the same as besthi
missing an H variable
missing potfraction variable
hipot should be 1 since we don't care about lows

Code:
     
      for (i=0; i<npockets; i++) {					\
        double potfrac = 0;						\
        int H = 0, L = 0;						\
        if (hival[i] != HandVal_NOTHING) {				\
          if (hival[i] == besthi) {					\
            H = hishare;						\
            potfrac += hipot;						\
            if (hishare == 1)						\
              result->nwinhi[i]++;					\
            else							\
              result->ntiehi[i]++;					\
          } else {							\
            result->nlosehi[i]++;					\
          }								\
        }	
result->nsharehi[i][H]++;					\

        if (potfrac > 0.99)						\
          result->nscoop[i]++;						\
        result->ev[i] += potfrac;					\
      }
The nsharehi[i][H]++ line of code stores the number of ties between H players for hand i I believe.
Help Calculating Tie %? Quote

      
m