Devon presented more of his Poker simulations now using Jd (the J database) at 
the most recent NYCJUG meeting 
(https://code.jsoftware.com/wiki/NYCJUG/2021-10-12 
<https://code.jsoftware.com/wiki/NYCJUG/2021-10-12>) 

He came up with an interesting problem of calculating the expected number of 
pairs in the initial flop in a game of Omaha. 

3 cards dealt into the flop. Consider those with only pairs in them, there 
would be 3 ways that the pairs could be dealt out. 

X X Y, X Y X, Y X X

Taking the first configuration the number of different hands you could make 
would be:

   */52 3 48  NB. this matches part of Devon’s calculation
7488 

NB. anyone of 52 cards can be dealt, once the card is dealt then only 1 of 3 
can be dealt to make the pair
NB. then we have to exclude the remaining 2 cards that match and therefore the 
third card will be anyone of 48 

NB. since there are 3 configurations the cards can be dealt in, the other 2 
would be calculated:
  */52 48 3
7488
  */48 52 3
7488

NB. this makes
   3*7488.    NB. Different 3 card hands with only pairs in them
22464

To calculate the percentage of the total number of hands Devon made the 
calculation using only one of the pairs hand configurations. Then used 3!52 for 
combinations of 52 things taken 3 at a time. 

This was off by a factor of 2 from his simulation, where he enumerated all the 
possibilities.

I finally realized (it took me 2 days of intermittent thought) that the order 
in which the cards are dealt matter. Not so much in the scoring of a hand but 
it does matter for the number of ways the same hand can be dealt out.

NB. So the total number of 3 card hands from 52 cards is:
    */52 51 50 
132600

NB. which is permutations of 52 things taken 3 at a time
NB. which like the Combinations function in J has a representation called the 
Stope function:
    52 ^!._1 (3)
132600

NB. Devon’s original calculation was:
   (*/52 3 48)%3!52
0.338824

NB. However based on the analysis above it should be:
   (3 * */52 3 48)%52 ^!._1 (3)
0.169412

NB. Which is very close to his simulated percentage: 0.169418

Devon was more concerned with scoring a hand rather than the order they were 
dealt in, when dealing with his calculation. 
So the best I could come up with to follow what I think was Devon’s thought 
process was the following:

NB. there are 13 different card values
NB. there are 2!4 combinations of pairs due to the different suits
NB. there will be 48 cards left over to make the flop since we exclude 3 of a 
kind (that’s a different type of poker hand than a pair)
NB. So:
   (*/13,(2!4),48)%3!52
0.169412

So the question is did I calculate these both correctly or did I just come up 
with 2 methods that match the simulation and just think my logic is correct?



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to