6

This is a tutorial for calculating poker probabilities from scratch. It is what I learned in my degree and even beforehand when I created and 5-card draw hand strength calculator.

The intention of this post is to make a cleaner community without similar questions cluttering our Q&A site, with more people understanding the importance of probabilities and making better use of them.

For programmers -which I expect to be the majority of people here, since I estimate most of the people here comes through visiting StackOverflow first- this article could be a hint for building calculation tools, websites, and even their own poker server with many stats analysis.

I took a lot writing this draft and hope you can collaborate if you find any mistake I could have commited in my examples.

We could make posts like this to avoid similar questions, and even focus as a community in wider topics.

The methodology remarked here serves not just for poker but for any french-deck card game, and even spanish-deck card game (by changing N=12 instead of 13), if asked the right question. This is like the Room of Requirements in Harry Potter: "if you have to ask, you will never know. If you know, you need only to ask", and this question's intention is to put you in the second part of the sentence.

How can I calculate the probabilities of running into a certain poker hand or situation I am interested about?

1
  • Should all of the italicised text really be in the question? Seems like a preface to the answer to me.
    – 3N1GM4
    Commented Dec 29, 2016 at 14:38

2 Answers 2

7

Welcome to the world of probabilities!

1. Questions, Answers, Frequencies

Probabilities calculation is about a question requiring an answer. It is about a question involving:

  • An initial state. This is the configuration of the world you want to analyze. This world is just a narrowed view of what you want to analyze. When analyzing poker hands and showdowns, the world you analyze is the shuffled deck.
  • A condition or predicate you expect to be true over the current configuration of said world.

Usually, when you analyze a logical proposition, you know whether it is TRUE or FALSE. But in the case of probabilities you are analyzing multiple instances of such proposition. As an example, you can ask a true/false proposition like this:

Does this world configuration bring me a 4 of a kind? AA KAAQJ >> True
Does this world configuration bring me a 4 of a kind? AK KAAQK >> False

You can notice the following traits of the question:

  • The world of analysis was just your hand, and the community cards.
  • The initial state is how the deck, having being shuffled, was dealt to make your hand and the community cards.
  • The condition was to get 4 of a kind among the seven cards.
  • The answer was true or false, given the whole known data.

BUT again, in probabilities, you analyze not just one single proposition but a wide proposition which covers all the possible initial state. There are two types of domains for this:

  • Discrete domains is when the amount of initial states is enumerable. This means that, for any given initial state, you can know which one would be the next initial state you'd ask, if trying the question one-by-one.
  • Continuous domains is when the amount of initial states is not enumerable. Most of the times this means involving real numbers, integrals, and a plot area to analyze.

In a hand-analysis question, the ultimate (reduced, in terms of computational complexity) version of the initial state is always how the deck was shuffled for this hand, and shufflings can be counted: you can establish the criterion to count shufflings. You don't have to believe me! You can test by yourself this Python code if you have access to an interpreter:

import itertools
deck = range(52) # Each card will be encoded in a number between 0 and 51
for shuffling in itertools.permutations(deck, 52)

This code will run over all the possible shufflings of the deck, so shufflings are enumerable (This code will take a lot! Press Ctrl+C to halt it or... wait millions of years to complete).

Conclusion: Poker hand analysis belongs to the discrete probabilities domain.

In the discrete domains, you enumerate the cases and apply them to the condition. You will get something like this:

  • All the possible initial states (again: ultimately this means all the possible shufflings).
  • All the expected cases (i.e. the subset of all the possible cases which passed the expected condition).
  • Ratio: This is the value you want. It will be a value between 0 and 1 (both bounds can occur! 0 means it never happens and 1 means it always happens). Usually you see this value expressed in a percentage format (0% to 100%).

However, remember: you do not test each case one-by-one. You apply specific formulas to test all the case at once.

So as you can tell, the answer will be a measure of cases to consider, among all possible cases, in a frequency format (given by the 0..1 returned value), calculated by given formulas we will see next.

2. Shuffles, Permutations, Combinations

Now we will tell the formulas, the reason of being, and how and when you apply them.

Please note: we will not use the stated python functions anymore, since those functions traverse all possible cases, and we are only interested in counting them, not traversing them.

Shuffles

  • When to use: The ultimate case of analysis is when you have the deck entirely shuffled. In games like 7 card stud with 8 players playing up to the last card, or 5 card draw with all the players switching their entire hands, you will notice that the initial deck shuffling matters.

Calculating possible distinct shuffles over a set is done by using factorial. Factorial is a recursive function for non-negative integers which ultimately calculates the product of a sequence of N consecutive integers. Examples:

5! = 5*4*3*2*1 = 120.

An exceptional case is 0! = 1. Factorials are not defined on negative numbers.

This has a direct relationship with amount of possible shuffles, because:

  • N! is calculated as N * (N - 1)!, where -again- 0! = 1 by definition.
  • The amount of possible shuffles of a deck of N elements is N possible cards in the top of the deck, multiplied by the amount of possible shuffles of a remaining deck of (N - 1) elements, where having a 0-card deck has only one possible shuffle: still the empty deck.
  • N = 52 in poker games (except for poker modes with wildcards, like caribbean poker, with a value of N = 53).

Permutations

Calculating possible distinct permutations involves shuffling a deck and taking a certain number R of cards from it. Your deck of N cards will be shuffled like this:

D1 D2 D3 D4 ... DN

And you are taking R cards, and leaving N-R cards in the deck:

D1 D2 ... DR taken, D(R+1) ... DN remaining

You will notice that the Python function I copied is already named permutations. This is because a full shuffling is a special case of a permutation, when we take the whole elements being shuffled into analysis.

N-R cards remain in the deck. A priori this calculation is the most useful one since the R taken cards are the ones that interact creating a poker hand involving the players. It is true that I said that the ultimate case of analysis is the whole shuffled deck, but it is also true that you don't care about more than 25 cards in a hold'em table with 10 players reaching the river. So for games like this, you care only about a subset of the shuffled cards, and so the R value (amount of taken cards) is lesser than the N (number of cards in the deck) value (it can never be greater!).

Take this example: just 4 cards (A, B, C, D being just the four aces) shuffled:

(for this example you can run the python function to generate the samples: permutate the 'ABCD' string by 4 elements to get the following list)

ABCD ABDC ACBD ACDB ADBC ADCB BACD BADC BCAD BCDA BDAC BDCA CABD CADB CBAD CBDA CDAB CDBA DABC DACB DBAC DBCA DCAB DCBA

There were 24 possible shufflings. Now assume I want to know only the possible cases for the first two cards of that shuffling (iterate over each element and just calculate element[:2] on each, using a list comprehension):

AB AB AC AC AD AD BA BA BC BC BD BD CA CA CB CB CD CD DA DA DB DB DC DC

All of them are repeated, twice in this case. The actual cases I care about is my two cards being like this:

AB AC AD BA BC BD CA CB CD DA DB DC

This is when you apply permutations. You get a lot fewer cases to account for. If you notice it, the amount of duplicates for each case is, actually, the amount of possible shuffles of the cards being ignored, which is actually the shuffling of (N-R) remaining cards, or (N-R)!. Notice that ignoring duplicates could be done here because the number of duplicates or copies is always the same for each possible case, so asking AB would mean both asking:

expected cases AB AB in AB AB AC AC AD AD BA BA BC BC BD BD CA CA CB CB CD CD DA DA DB DB DC DC

or

expected case AB in AB AC AD BA BC BD CA CB CD DA DB DC

(2/24 is the same as 1/12 by simplifying or reducing the fraction)

The fraction is the same value, so you can specialize the shuffles into permutations to ignore the middle step of simplifying both sides in your mind.

However, in the implementation details, the formula:

NpN = N!

becomes:

NpR = N!/(N-R)!

Since in such formula, you need to account for them being different calculations. In practice, the calculation becomes:

NpR = N*(N-1)*...*(N-R+1)

always being R <= N.

It is important to consider this:

  • This operation is the building block of most of the poker probabilities calculation except in the cases I stated.
  • We reached this operation by dividing on shufflings we did not care about. Which implies:
    • When you study cases of R-sized possible distinct set cases and it happens that you want to consider shuffling on the R elements, you must multiply the amount of cases by R!.
    • When you study cases of R-sized possible distinct sequence cases and it hannd you suddenly don't care anymore about the shuffling on the R elements, you have to collapse every possible shuffling in one case, which involves dividing by R!.
    • This means: A sequence is a shuffled set case. A set case is the set of elements of a sequence, disregarding the order. Asking for a sequence in the domain of set cases implies converting the set cases into sequences, multiplying the amount of cases by R! (the amount of possible shufflings of a set case).

Which leads on the calculation of ...

Combinations

We already showed why we divide by the factorial of (N-R): to ignore possible shufflings of the remaining cards.

A combination is essentialy a permutation for which we ignore its shuffling. An example of this is when we ask regarding our hole cards: we don't care in what order we receive or hole cards, but what the cards are. Assume I want to tell the cases of haing a royal flush of spades in 5 card draw (yep, the Maverick's finale hand):

A K Q J T spades

There is only one combination of cards I care about, but there are 120 (5!) possible permutations. Since I don't care about the possible permutations, my expected cases collapse to just one case.

In Hold'Em, this just means dividing by 2. In 7-stud this means dividing by 6 (3!) for the initial cards.

The calculations for combinations become:

NcP = NpR/R!

Or ...

NcR = N!/(N-R)!/R!

Or ...

NcR = N!/((N-R)!*R!)

In practice, the implementation is the same as NpR but dividing the resulting value by 1*...*R.

Python implementations could be like this:

shufflings = lambda n: reduce(operator.mul, range(1, n+1))
permutations = lambda n, r: reduce(operator.mul, range(n-r+1, n+1))
combinations = lambda n, r: permutations(n, r) / shufflings(r)

If you are a programmer, you can install a python interpreter (linux distribution have one by default in most cases) and test these functions with ipython, against counting the generated items by itertools.combinations and itertools.permutations. If you are not a programmer, this site helps you calculating permutations and combinations. Again: to calculate full deck shufflings, calculate a permutation with R = N = 52.

Examples of usage

  • Amount of possible standard deck shufflings? 52! (shufflings).
  • Amount of possible suit combinations for any pair? 4c2 (4 suits, taking two).
  • Amount of possible 4-of-a-kind hands? This one is tricky. Involves every possible case for the 4 equal cards, order doesn't matter, and every possible remaining card (48 remaining) for each possible case of 4 equal cards. 13 (possible combinations of 4oak) * 48 (remaining cards).
  • Amount of possible 4-of-a-kind values (i.e. suit does not matter for kicker)? This one is like a permutation among the 13 possible values: which value goes for the 4 of a kind, and which value goes for the kicker: 13p12 (permutations).

3. It is all about asking the right question!

I told you that probabilities calculation is about asking the right question, assuming the right conditions, and how those conditions can be transformed across different domains (full shufflings <-> permutations by a factor of (N-R)! and permutations <-> combinations by a factor of R!).

Remember that probabilities is the expected / whole ratio in the discrete case (and expected area / whole area in continuous)? It is time to put this in practice.

The best way to put it in practice is by example. So let's practice!

What is the probability of getting AA in my hole cards in Texas Hold'Em?

The actual card value I ask is irrelevant here! Asking about AA or KK or 22 will bring the same value

  • Whole cases: Since I only care about my hole cards, I take two cards out of the whole deck. It doesn't matter if I am the first or last player receiving cards. As long as I don't have more information of the initial state, I am still taking two cards out of 52. Additionally, I don't care in which order I receive those cards, so it is not a permutation but a combination of two cards. The whole cases I want to study is 52c2 = 1326 possible cases.
  • Expected cases: I expect two aces. Among the possible cards combinations, there are certain combinations that will be AA. How many combinations? Lets see... 4 possible suits (S, D, H, C) bring 4 possible aces, and I need a combination of two aces out of the possible four aces. My expected cases are aces of SD SH SC DH DC HC (combinations!, so order does not matter: HC and CH is the same so we use combinations). The formula to apply here is the combinatorial with 4 taking two: 4c2 = 6.
  • Probability of getting: expected / whole = 6 / 1326 = 1 / 221, or one in 221 draws.

What is the probability of getting a pair (and not a better hand!) in the flop?

The world configuration I want, in this case, must be split in three cases:

  • Hole pair: 6 * 13 (6 is the expected case, but we must multiply over the possible card values. The expected world configuration responds to the pattern XX ??? (both the XX and ??? are separate and combinatorial, since they are dealt in separate moments but together, and you don't care in which order the flop cards were flopped).
  • Flopped pair: The expected world configuration responds to the pattern ?? XX? (again: both the XX and ??? belong to separate and combinatorial spaces).
  • Connected pair: The expected world configuration responds to the pattern X? X?? (again: both the XX and ??? belong to separate and combinatorial spaces).

If you can notice, the spaces being analyzed is the same everytime: 2 cards combined out of 52, and 3 cards combined out of 50 (if you combine backwards, like saying 3 out of 52 and 2 out of 49, the result will be the same). Since they use all the same space, you do not need to convert them to wider spaces (in this case, the widest space not involving more cards is 52p5).

The overall initial conditions amount is: 52c2 * 50c3 = 25989600 cases.

Please note: For this question, which restricts to just pairs, the cards in ? cannot be the same value as X, and must also be distinct values among themselves

So we need to calculate the expected cases for each space!

  • Hole cards: 13 (different example values for a pair) * 4c2 (two suits out of 4) * 64 (three different suits which can be the same for the flop cards) * 12c3 (three different values for flop cards) = 1098240 cases.
  • Connected cards: 13 (different example values for a pair) * 4 (one suit out of 4 for the first hole card) * 12 (the value for the second hole card, which will be different) * 4 (one suit out of 4 for the second hole card) * 1 (the same example matching value) * 3 (one suit out of 3 for the flop card matching the hole card) * 4 * 4 (two arbitrary suits for the remaining flop cards) * 11c2 (any combination of two remaining values) = 6589440 cases.
  • Flop cards: 4 * 4 (two arbitrary suits in your hand, which could be the same) * 13c2 (a combination of two distinct values) * 4c2 (two suits out of 4 for the paired cards) * 11 (different example values for a pair) * 4 (suit for the remaining distinct card) 10 (possible values for the remaining flop card) = 10982400 ` cases.
  • Add the three scenarios!: 1098240 (hand) + 6589440 (connected) + 3294720 (flop) = 10982400 cases
  • Recall the amount of whole cases: 25989600.
  • Ratio: like 0.42 or 42%.
  • Add the two scenarios if I don't want the in-table pair: 1098240 + 6589440 / 25989600 = like 0.29 or 29%.

Making a constructive analysis.

For the second question example (exactly one pair, no better hand), you have three different analysis to make:

  • XX ??? require that the ??? use three different values. Consider that we stole one value for the X from the 13 available values (2..A), and have 12 remaining values for the ? cards. I can make six (4c2) combinations of suits for my XX cards, which would work, among 1326 (52c2) combinations in my hand. Saying this, I know beforehand that the space I want to consider for my hand is combinatorial (again: the order in my hand does not matter). The flop cards are distinct in value, and can have same or distinct suits. It doesn't matter the order among them, so the flop itself is also combinatorial: we calculate 12c3 for the combination of values, and 4*4*4 for the combination of suits. Since the flop space is combinatorial, we calculate 50c3 for the remaining cards.
  • X? X?? is a bit different. You can pick any value for the X (out of 13, again). Freeze that value for a moment. You will have 4 possible suits for that value and 48 possible cards for the other card, among 52c2 possible combinations. In the flop you will have 3 independent suits (yielding 64 suit combinations), with just a combination of 2 out of 11 possible remaining values. Again the flop space is combinational: the order of the cards being dealt does not matter. Now multiply by 13 to account the possible pair values, and you're in the other side :).
  • ?? XX? is quite different: You will combine two different values in your hand (13c2), with any arbitrary independent pairing for suits (16). The flop will have 4c2 suit combinations for the XX cards, and 4 possible suits for the remaining card, which can pick only among 11 values (two of them were already picked).

Trivia If you are smart with numbers you can notice the following pattern:

  • 1098240 corresponds to scenario XX ???.
  • 6589440 is 6 times 1098240, and it covers X? X??, X? ?X?, X? ??X, ?X X??, ?X ?X?, and ?X ??X scenarios (total: 6) for the connected pair.
  • 3294720 is 3 times 1098240, and it covers ?? XX?, ?? X?X, and ?? ?XX (total: 3) scenarios for the flopped pair.
  • You can guess that by enumerating explicitly the 10 possible scenarios and calculating them in the realm of permutations instead of combinations (since I would already be permutating the Xs and ?s) the applied formulas would be the exact same on each case, with different layout. The final cases results would be similar (not the same as these applied formulas, but still the same proportion between hand, connected, and flopped). The final ratios would be the exact same. This is an exercise I leave to you.

So always try to cross-check whether you used the right formula and assumptions.

Construct for any poker game

In each poker game, the received cards belong to different moments in your analysis and/or have different qualities. But such qualities depend on your question! Examples:

In an analysis caring about the cards timing:

  • The Hold'Em/Omaha hole cards have the same qualities: they are secret and received by you in the same moment. Among them, you will treat combinations, because since the cards have the same qualities, you will not account for the order of receiving them.
  • The Hold'Em/Omaha flop cards have the same qualities: they are public and received in the same moment. The same regarding the order applies here.
  • The HE/O turn and river have different qualities: they are public but received in different moments.

So for them you will compute your space like 52c2 (hole cards) * 50c3 (flop cards) * 47 (turn) * 46 (river) overall possibilities.

You can think like this:

  • Card group involving similar elements can compute its probabilities by combinations in whole and expected cases.
  • Card group involving different elements must compute its probabilities in terms of -not exactly but conceptually similar- permutations. This is because it is not the same to have the same card as one element than as another element, and so the order matters here.

So:

  • I took the first 2 cards out of 52, and consider them in combination.
  • I took the next 3 cards out of 50, and consider them in combination. But note how the former conditioned the world in a permutational fashion: it is not the same to receive X in hole and Y in flop, than Y in hole and X in flop, so they only relate in a permutational way in the sense than I must not divide by, say, 2! (which would erroneously belong to shuffling the flop and hole).
  • I took the next 1 card out of 47.
  • I took the next 1 card out of 46.

However, in a static analysis at the river, not counting the timing but asking about the overall table state at the end, you will have only two spaces to consider: 52c2 (hole) * 50c5 (community), because those spaces are:

  • I took the first 2 cards out of 52, and consider them in combination.
  • I took the next 5 cards out of 50, and considr them in combination (I dont care about their order anymore).

4. Conclusion

  • Take the game type into consideration and the true nature of the world you want to analyze. That world will break into sub-spaces later.
  • Ask the right question and consider the involved spaces:
    • If the suits or values of related spaces in the question are not independent, you will make a permutation out of them (if additionally the order among them does not matter, you will make a combination instead). If they are independent, their spaces will be multiplied (examples: when suits restricted among themselves I calculated like 4c2, but when the values were those restricting among themselves, I considered the suits as independent and calculated like 4*4).
    • Whatever your choice between permutations, combinations, and independence ensure it is consistent: the same calculation type you use in the overall cases, you will use for the expected cases.
  • Correctly identify disjoint and overlapping scenarios! As I did in the pair question.
  • Learn Python, use the Python functions I told you. Remember that you should always validate R <= N. Remember that probabilities is a number between 0 and 1. You must multiply by 100 to have a percent value.
  • Learn academical documents regarding conditional probabilities, discrete probabilities spaces, independent probability events, and in general everything about that frequently underestimated subject!
2
  • I haven't read through all of this, but from the parts I've gone through, this is an amazing job! Even though it's pretty long, there's a ton of good stuff presented clearly and concisely that could answer many of the questions that get asked on here (or elsewhere). Commented Jul 12, 2016 at 13:29
  • I hope it is clear enough for mst ppl Commented Jul 12, 2016 at 15:22
0

This is the 5 card poker hands
This matches all the hand counts here WIKI poker probabilites

If you are going to write any type of equity calculator, game, or bot this is where I recommend you start. Any simulation needs to be able to identify hands.

At 5 cards it is easy with combination.

Monte Carlo is popular for running random suffles but this just runs all the hands. Computers are getting fast enough that you can run all the hands. This runs the 2,598,960 possible 5 card combinations in 1 second.

This is .NET C#

public void Deal5()
{
    Stopwatch sw = new Stopwatch();
    sw.Start();
    //int[,] deck = new int[4, 13];
    //for(int i = 0; i < 52; i ++)
    //    Debug.WriteLine("Suit = " + (i / 13)  + " Rank = " + i % 13);
    int counter = 0;
    int counterFlush = 0;
    int counterStraight = 0;
    int counterStraightFlush = 0;
    int counterQuad = 0;
    int counterBoat = 0;
    int counterTrips = 0;
    int counterPairTwo = 0;
    int counterPairOne = 0;
    int counterHigh = 0;
    //Random rand = new Random();
    //Dictionary<int, int> rankCount = new Dictionary<int, int>(5);
    int card1rank;
    int card1suit;
    int card2rank;
    int card2suit;
    int card3rank;
    int card3suit;
    int card4rank;
    int card4suit;
    int card5rank;
    int card5suit;
    bool haveStraight;
    bool haveFlush;
    int[] rankArray = new int[13];
    int rankArrayMax;
    int straightCount;
    bool quad;
    bool trips;
    int pairs;
    for (int i = 51; i >= 4; i--)
    {
        card1rank = i % 13;
        card1suit = i / 13;
        for (int j = i - 1; j >= 3; j--)
        {
            card2rank = j % 13;
            card2suit = j / 13;
            for (int k = j - 1; k >= 2; k--)
            {
                card3rank = k % 13;
                card3suit = k / 13;
                for (int l = k - 1; l >= 1; l--)
                {
                    card4rank = l % 13;
                    card4suit = l / 13;
                    for (int m = l - 1; m >= 0; m--)
                    {
                        counter++;
                        haveStraight = false;
                        haveFlush = false;
                        card5rank = m % 13;
                        card5suit = m / 13;

                        haveFlush = (card1suit == card2suit && card1suit == card3suit && card1suit == card4suit && card1suit == card5suit);

                        rankArray[0] = 0;
                        rankArray[1] = 0;
                        rankArray[2] = 0;
                        rankArray[3] = 0;
                        rankArray[4] = 0;
                        rankArray[5] = 0;
                        rankArray[6] = 0;
                        rankArray[7] = 0;
                        rankArray[8] = 0;
                        rankArray[9] = 0;
                        rankArray[10] = 0;
                        rankArray[11] = 0;
                        rankArray[12] = 0;

                        rankArray[card1rank]++;
                        rankArray[card2rank]++;
                        rankArray[card3rank]++;
                        rankArray[card4rank]++;
                        rankArray[card5rank]++;

                        rankArrayMax = 1;
                        straightCount = 0;
                        for (int q = 0; q < 13; q++)
                        {
                            if (rankArray[q] > rankArrayMax)
                                rankArrayMax = rankArray[q];
                            if (rankArrayMax > 1)
                                break;  // cannot make a straight if there are any pairs
                            if (rankArray[q] == 1)
                            {
                                straightCount++;
                                if (straightCount == 5)
                                    break;
                            }
                            else
                                straightCount = 0;
                        }
                        //                                     ace high straight
                        haveStraight = (straightCount == 5 || (straightCount == 4 && rankArray[0] == 1));

                        if (haveStraight && haveFlush)
                            counterStraightFlush++;
                        else if (haveFlush)
                            counterFlush++;
                        else if (haveStraight)
                            counterStraight++;
                        else if (rankArrayMax == 1)
                            counterHigh++;
                        else
                        {
                            //continue;
                            quad = false;
                            trips = false;
                            pairs = 0;
                            //foreach (int r in rankArray.OrderByDescending(x => x))  for some reason this was SLOW
                            for (int q = 0; q < 13; q++)
                            {
                                if (rankArray[q] <= 1)
                                    continue;
                                //Debug.WriteLine(r);
                                if (rankArray[q] == 2)
                                    pairs++;
                                else if (rankArray[q] == 3)
                                    trips = true;
                                else
                                    quad = true;
                            }

                            if (trips)
                            {
                                if (pairs > 0)
                                    counterBoat++;
                                else
                                    counterTrips++;
                            }
                            else if (pairs == 1)
                                counterPairOne++;
                            else if (pairs == 2)
                                counterPairTwo++;
                            else
                                counterQuad++;
                        }
                    }
                }
            }
        }
    }
    sw.Stop();
    Debug.WriteLine("hand count            " + counter.ToString("N0"));
    Debug.WriteLine("stopwatch millisec    " + sw.ElapsedMilliseconds.ToString("N0"));
    int sum = counterHigh + counterPairOne + counterPairTwo + counterTrips + counterStraight
            + counterFlush + counterBoat + counterQuad + counterStraightFlush;
    Debug.WriteLine("straightFlush counter " + counterStraightFlush.ToString("N0") + "        " + (100m * counterStraightFlush / sum).ToString("N4"));
    //Debug.WriteLine("supposed to be        " + ((int)40).ToString("N0"));
    Debug.WriteLine("quad count            " + counterQuad.ToString("N0") + "       " + (100m * counterQuad / sum).ToString("N4"));
    Debug.WriteLine("boat count            " + counterBoat.ToString("N0") + "     " + (100m * counterBoat / sum).ToString("N4")); // + " " + (100m * ((100m * counterBoat / sum) - 0.144057623049m) / 0.144057623049m).ToString("N4"));
    Debug.WriteLine("flush counter         " + counterFlush.ToString("N0") + "     " + (100m * counterFlush / sum).ToString("N4"));
    //Debug.WriteLine("supposed to be        " + ((int)5148).ToString("N0"));
    Debug.WriteLine("straight counter      " + counterStraight.ToString("N0") + "    " + (100m * counterStraight / sum).ToString("N4"));
    //Debug.WriteLine("supposed to be        " + ((int)10240).ToString("N0")); 
    //Debug.WriteLine("counterStraightTop    " + counterStraightTop.ToString("N0"));
    //Debug.WriteLine("counterStraightTopNot " + counterStraightTopNot.ToString("N0"));
    //Debug.WriteLine("diff striaght         " + (counterStraight - 10240).ToString("N0"));
    Debug.WriteLine("trips count           " + counterTrips.ToString("N0") + "    " + (100m * counterTrips / sum).ToString("N3"));
    Debug.WriteLine("two pair count        " + counterPairTwo.ToString("N0") + "   " + (100m * counterPairTwo / sum).ToString("N3"));
    Debug.WriteLine("one pair counter      " + counterPairOne.ToString("N0") + " " + (100m * counterPairOne / sum).ToString("N2"));
    Debug.WriteLine("high card counter     " + counterHigh.ToString("N0") + " " + (100m * counterHigh / sum).ToString("N2"));// + " " + (100m * ((100m * counterHigh / sum) - 50.11773940m) / 50.11773940m).ToString("N4"));
    Debug.WriteLine("sum                   " + sum.ToString("N0"));
    sw.Stop();
    Debug.WriteLine("stopwatch millisec    " + sw.ElapsedMilliseconds.ToString("N0"));
    Debug.WriteLine("");
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.