Since this is very easy to code I coded both a simulation and a brute force routine. For what it is worth, I will post the code knowing that it is surely inefficient but it seemed to get the job done.
Simulation
Code:
simturnflushdraw=function(trials)
{
tally=0
for(dealy in 1:trials)
{
cardy=sample(52,6)
suity=suits(cardy)
suitcounts=tabulate(suity,nbins=4)
if((max(suitcounts))==4)
{
foursuit=which(suitcounts==4)
holeysuits=suity[1:2]
if((sum(holeysuits==foursuit))>0) tally=tally+1
}
}
pct=100*tally/trials
return(pct)
}
Simulation results of 5 batches of 10 million trials each:
9.72085%
9.71008%
9.71537%
9.71651%
9.71166%
Brute Force Program
Code:
tallyturnflushdraw=function(dummy)
{
count=0
tallyzero=0
tallyones=0
tallytwos=0
for(b1 in 1:49)
{
for(b2 in (b1+1):50)
{
for(b3 in (b2+1):51)
{
for(b4 in (b3+1):52)
{
boardy=c(b1,b2,b3,b4)
stubby=setdiff((1:52),boardy)
for(h1 in 1:47)
{
for(h2 in (h1+1):48)
{
count=count+1
holey=stubby[c(h1,h2)]
allsix=c(boardy,holey)
suitsix=suits(allsix)
suitholey=suitsix[c(5,6)]
suitcounts=tabulate(suitsix,nbins=4)
maxsuitcounts=max(suitcounts)
if(maxsuitcounts==4)
{
foursuit=which(suitcounts==4)
if((sum(suitholey==foursuit))==0) tallyzero=tallyzero+1
if((sum(suitholey==foursuit))==1) tallyones=tallyones+1
if((sum(suitholey==foursuit))==2) tallytwos=tallytwos+1
}
}
}
}
}
}
}
temp=c(tallyzero,tallyones,tallytwos,count)
return(temp)
}
Brute force results were as follows (these agree with the combinatoric results posted up thread):
- Number of flush draws using 2 hole cards = 12,715,560
- Number of flush draws using 1 hole cards = 16,954,080
- Number of flush draws using 0 hole cards = 2,119,260
- Total number of cases (denominator) = 305,377,800