Using a well shuffled standard $52$ card deck, $2$ players (call them A and B) decide to play a game. They draw community (shared) cards (without replacement) until a winner for that hand is declared or they run out of cards to draw, whichever comes first. For A to win, there has to be three length $3$ ascending straights drawn in order such as $6,7,8$ ... $2,3,4$... $10,J,Q$. The $3$ straights have to all be "gapped" by at least $1$ rank so something like $7,8,9$ ... $10,J,Q$ ... $2,3,4$ is not a winner for A because of the $9$ and $10$ not being gapped. The rank $2$ card is considered the lowest card and the $A$ card is considered the highest ranked card so $A,2,3$ is NOT considered a straight. For B to win, there has to be a straight of length $6$ such as $7,8,9,10,J,Q$.
So who has the higher probability to win and by how much?
My initial simulation had an error in it so I fixed and am rerunning it.
An example of a tie would be $2,3,4,6,7,8,7,8,9,10,J,Q$ The Q gives A and B the last card needed at the same time so that is a tie (no win for either).
I am now trying to do some mathematical analysis on paper starting with simple enumeration of the different ways for A to win. I see $10$ patterns:
$~1$) $2,3,4,6,7,8,10,J,Q$
$~2$) $2,3,4,6,7,8,J,Q,K$
$~3$) $2,3,4,6,7,8,Q,K,A$
$~4$) $2,3,4,7,8,9,J,Q,K$
$~5$) $2,3,4,7,8,9,Q,K,A$
$~6$) $2,3,4,8,9,10,Q,K,A$
$~7$) $3,4,5,7,8,9,J,Q,K$
$~8$) $3,4,5,7,8,9,Q,K,A$
$~9$) $3,4,5,8,9,10,Q,K,A$
$10$) $4,5,6,8,9,10,Q,K,A$
For player B to win, there are only $8$ ways:
$1)~ 2,3,4,5,6,7$
$2)~ 3,4,5,6,7,8$
$3)~ 4,5,6,7,8,9$
$4)~ 5,6,7,8,9,10$
$5)~ 6,7,8,9,10,J$
$6)~ 7,8,9,10,J,Q$
$7)~ 8,9,10,J,Q,K$
$8)~ 9,10,J,Q,K,A$
What I will do is create a bucket for each possible pattern (way) to win shown above and count them up to make sure the program is catching all of them. I think they should all be equally likely.
What if we started by just doing a "straight" analysis of the probability or A winning ignoring any cases where B wins first? What if we also do the same thing and compute the chances of B winning ignoring cases where A wins first. I wonder how far off those will be from the simulated results.
Would this analysis be correct for computing the chance of B winning if there was no player A?
Chance of choosing good 1st card is $32/52$, good 2nd card is $4/51$, good 3rd card is $4/50$, good 4th card is $4/49$, good 5th card is $4/48$, and good 6th card is $4/47$. This is about $1$ in $447,000$ but that is only counting an immediate win for B with only $6$ cards drawn. B can use the full deck if need be to win so how do I compute that using math? In other words, if the only player is B how many hands on average will be required for a B win?
It seems A has the advantage, not B like I originally thought. I put extra checks into the program to make sure it is working correctly. I originally missed a few cases for A winning, thus the program reported lower winnings for A than should have been. Simulating $250~million$ hands, I am now seeing $38,060$ wins for A and $24,337$ wins for B with $4$ ties. So that is about $61$% for A and about $39$% for B when someone wins the hand. Average # of cards for each win was about $41.2$ for A and about $28.8$ for B for a weighted average of about $36.4$. That is, if any win happens, either A or B, on average about $36.4$ cards will have been drawn which is more than $2/3$rds of the entire deck. For the $4$ ties, average # of cards was $(43+45+51+29)/4 = 42$.
The $29$ card tie had the following cards (T=$10$):
3Q$345$K$89T$A932Q7AQ89847J$9TJQKA$
In this run of $250~million$ hands, the shortest card sequence for a win for A was $9$ and for B was $6$. The longest card sequence for both was $52$ (for a win).
Another interesting thing I tried was I programmed the simulation to tell me how often in all $52$ cards will A and B both have a candidate win (but not necessarily on the same card). Out of $10~million$ full $52$ card hands, it reported on $8$ were multicandidate winners. That helps explain why ties are even more rare cuz for those you need $2$ candidate winners AND they both must be on the same final drawn card (such as card $42$ for example).
The only thing slightly suspicious I see with the revised (corrected) code is I made buckets for each of the $10$ ways (patterns) where A can win and also the $8$ ways (patterns) where B can win thinking they would all be about the same number but there seems to be a slight bias towards the lowest numbered bucket for each, indicating that the low # card wins are appearing more. This may be cuz of the way I check for wins which starts at the lowest numbered sequences (such as $2,3,4$) and whenever A or B wins, the checking is "short circuited" (terminated) for that hand. It could also be that $250~million$ hands is not enough to allow them (the buckets) to "normalize". Perhaps I need $1~billion$ or more hands.
My simulation works by first shuffling the entire deck of $52$ cards and then I simply search the entire deck for the $18$ patterns ($10$ for A and $8$ for B) that indicate a candidate win for either. I also check for ties. Sometimes A and B have candidate wins in the same hand but one comes before the other. In that case I simply award the win to whoever got the candidate win first (with the fewer number of cards). It seemed simpler to me to implement the simulation this way since I don't have to pick one card at a time and check for a winner as I go. It is like I shuffle the deck, lay all the cards out on a table all at once, then search for the winner. Even using an interpreted language (not compiled) which only uses $50$% of my CPU max and is much slower than any compiled language, I can simulate $1$ million hands in about $1.3$ minutes. $1$ billion would take about $22$ hours. Someday I would like to implement this in c or some other compiled language and see how fast I can get it to go.
It is fun having a simulation program for card games like this cuz it allows easy analysis of different patterns by just making buckets for them to just count up.
If this problem is too difficult to solve mathematically, I wish someone else would at least try a simulation as well to confirm the results and compare speeds.