jj比赛博雅德州扑克克自由桌怎么没有50000场的

2015华为软件精英挑战赛(3)
由于比赛500ms的时间限制,想要知道自己的牌力胜率是多大,我们采取了蒙特卡洛法,模拟对手的手牌,计算自己的胜率,依据胜率作出决策
经过几次改进,该模拟算法可以在500ms以内完成,从而可以保证不超时
void sortCards(card mcard[], int num)
&&& int temp = 0,temp2;
&&& for (int i = 0; i & i++)
&&& for (int j = 0; j & num - i - 1; j++)
&&&&&&& if (mcard[j].point & mcard[j + 1].point)
&&&&&&&&&&& temp = mcard[j].
&&&&&&&&&&& mcard[j].point = mcard[j + 1].
&&&&&&&&&&& mcard[j + 1].point =
&&&&&&&&&&& temp2=mcard[j].
&&&&&&&&&&& mcard[j].color=mcard[j+1].
&&&&&&&&&&& mcard[j+1].color=temp2;
void sortCardsColor(card mcard[], int num)
&&& int temp = 0,temp2;
&&& for (int i = 0; i & i++)
&&& for (int j = 0; j & num - i - 1; j++)
&&&&&&& if (mcard[j].color & mcard[j + 1].color)
&&&&&&&&&&& temp = mcard[j].
&&&&&&&&&&& mcard[j].point = mcard[j + 1].
&&&&&&&&&&& mcard[j + 1].point =
&&&&&&&&&&& temp2=mcard[j].
&&&&&&&&&&& mcard[j].color=mcard[j+1].
&&&&&&&&&&& mcard[j+1].color=temp2;
void produceNumbersCard(card mcard[], int size =RANDSIZE)
&&& srand(time(NULL));
&&& for (int i = 0; i& i++)
&&&&&&& mcard[i].point = ((rand() % (14 - 2 + 1)) + 2);
&&& srand(time(NULL));
&&& for (int i = 0; i& i++)
&&&&&&& mcard[i].color = ((rand() % (4 - 1 + 1)) + 1);
bool isInHadCards(card newCard, card hadCard[],int hadCardSize)
&&&& for (int i = 0; i & hadCardS i++)
&&&&&&&& if (newCard.point == hadCard[i].point&&newCard.color == hadCard[i].color)
&&&&&&&& {
&&&&&&&&&&
&&&&&&&& }
long calculTongHuaShun(card th[])
&&& if((th[0].point-th[4].point)==12)
&&&&&&& return ;;&& //A5432
&&& long temp=0;
&&& temp=th[0].point*;th[1].point*6000+th[2].point*400+th[3].point*20+th[4].
&&& return temp+;
long calculSiTiao(card st[])
&&& if(st[0].point==st[1].point)& //四条在前,单牌在后88883;
&&&&&&& return st[0].point*400+st[4].point+;
&&& else&&&&&&&&&&&&&&&&&&&&&&&& //四条在后,单牌在前52222;
&&&&&&& return st[1].point*400+st[0].point+;
long calculLuHua(card Lh[])
&&& if(Lh[0].point==Lh[1].point&&Lh[1].point==Lh[2].point) //表示三条在前
&&&&&&& return Lh[0].point*400+Lh[3].point+9000000;
&&& else&&&&&&&&&&&&& //表示两条在前
&&&&&&& return Lh[2].point*400+Lh[0].point+9000000;
long calculTongHua(card th[])
&& long temp=0;
&& temp=th[0].point*;th[1].point*6000+th[2].point*400+th[3].point*20+th[4].
&& return temp+7000000;
long calculShunZi(card sz[])
&&& long temp=0;
&&& temp=sz[0].point*;sz[1].point*6000+sz[2].point*400+sz[3].point*20+sz[4].
&&& return temp+5000000;
long calculSanTiao(card sant[])
&&& int k=0;& //记录第一个三条出现的位置
&&& for(int i=0;i&3;i++)
&&& {&& //如果三张牌连续相等
&&&&&&& if(sant[i].point==sant[i+1].point&&sant[i+1].point==sant[i+2].point)
&&&&&&&&&& k=i;
&&& switch(k)
&&& case 0: return sant[0].point*400+sant[3].point*20+sant[4].point+4000000;//55543
&&& case 1: return sant[1].point*400+sant[0].point*20+sant[4].point+4000000;//65553
&&& case 2: return sant[2].point*400+sant[0].point*20+sant[1].point+4000000;//76555
long calculLiangDui(card Ld[])
&&& int fk=0,sk=0;& //分别用来记录第一对与第二对的位置
&&& if(Ld[0].point==Ld[1].point)
&&&&&&& fk=0;
&&& else if(Ld[1].point==Ld[2].point)
&&&&&&& fk=1;
&&& if(Ld[2].point==Ld[3].point)
&&&&&&& sk=2;
&&& else if(Ld[3].point==Ld[4].point)
&&&&&&& sk=3;
&&& if(fk==0&&sk==2)&& //66553
&&&&&&& return Ld[0].point*400+Ld[2].point*20+Ld[4].point+3000000;
&&& else if(fk==1&&sk==3)//76655
&&&&&&& return Ld[1].point*400+Ld[3].point*20+Ld[0].point+3000000;
&&& else&&&&&&&&&&&&&&&&& //77566
&&&&&&& return Ld[0].point*400+Ld[3].point*20+Ld[2].point+3000000;
long calculYiDui(card yd[])
&&& int ydk=0;& //记录一对的位置
&&& for(int i=0;i&4;i++)
&&&&&& if(yd[i].point==yd[i+1].point)
&&&&&&&&&& ydk=i;
&&&&&&&&&&
&&& switch(ydk)
&&& //77654
&&& case 0: return yd[0].point*6000+yd[2].point*400+yd[3].point*20+yd[4].point+2000000;
&& //87754
&&& case 1: return yd[1].point*6000+yd[0].point*400+yd[3].point*20+yd[4].point+2000000;
&&& //98775
&&& case 2: return yd[2].point*6000+yd[0].point*400+yd[1].point*20+yd[4].point+2000000;
&&& //98766
&&& case 3: return yd[3].point*6000+yd[0].point*400+yd[1].point*20+yd[2].point+2000000;
long calculGaoPai(card gp[])
&&& long temp=0;
&&& temp=gp[0].point*;gp[1].point*6000+gp[2].point*400+gp[3].point*20+gp[4].
long mycalcul7Card(card seven[])
&& &card tsc[7];
&& &for (int i = 0; i&7; i++)
&& &&& &tsc[i].point = seven[i].
&& &&& &tsc[i].color = seven[i].
&& &sortCards(tsc, 7);
&& &//是否有同花顺
&& &card tTHS[5];
&& &int tempTHSpoint = 0, tempTHSsize = 1;
&& &card tempTHSFive[5];& //储存已经找到的五张最大顺子
&& &card tempTHS[7];
&& &&& &tempTHSpoint = tsc[0].
&& &&& &tempTHS[0].point = tsc[0].
&& &&& &tempTHS[0].color = tsc[0].
&& &//去重 9987654.
&& &for (int i = 1; i&7; i++)
&& &&& &if (tempTHSpoint != tsc[i].point)
&& &&& &&& &tempTHSpoint = tsc[i].
&& &&& &&& &tempTHS[tempTHSsize].point = tsc[i].
&& &&& &&& &tempTHS[tempTHSsize].color = tsc[i].
&& &&& &&& &tempTHSsize++;
&& &if (tempTHSsize &= 5) //表示去重之后还有至少5张牌
&& &&& &int j = 0;
&& &&& &sortCards(tempTHS, tempTHSsize);
&& &&& &//进行是否是顺子除了A5432
&& &&& &for (int i = 0; i &= tempTHSsize - 5; i++)
&& &&& &&& &if (tempTHS[i].point == tempTHS[i + 1].point + 1\
&& &&& &&& &&& &&&tempTHS[i + 1].point == tempTHS[i + 2].point + 1\
&& &&& &&& &&& &&&tempTHS[i + 2].point == tempTHS[i + 3].point + 1\
&& &&& &&& &&& &&&tempTHS[i + 3].point == tempTHS[i + 4].point + 1\
&& &&& &&& &&& &)
&& &&& &&& &{
&& &&& &&& &&& &for (j = j&i + 5; j++) //把这五张顺子储存下来
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tempTHSFive[j - i].point = tempTHS[j].
&& &&& &&& &&& &&& &tempTHSFive[j - i].color = tempTHS[j].
&& &&& &&& &&& &}
&& &&& &&& &&& &//判断这个顺子是否是同花
&& &&& &&& &&& &sortCardsColor(tempTHSFive, 5);
&& &&& &&& &&& &if (tempTHSFive[0].color == tempTHSFive[1].color\
&& &&& &&& &&& &&& &&&tempTHSFive[1].color == tempTHSFive[2].color\
&& &&& &&& &&& &&& &&&tempTHSFive[2].color == tempTHSFive[3].color\
&& &&& &&& &&& &&& &&&tempTHSFive[3].color == tempTHSFive[4].color)
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &return calculTongHuaShun(tempTHSFive);
&& &&& &&& &&& &}
&& &&& &&& &&& &else
&& &&& &&& &&& &&& &
&& &&& &&& &}
&& &&& &} //跳出for,表示没有找到顺子,继续找是否有A5432
&& &&& &sortCards(tempTHS, tempTHSsize);
&& &&& &if (tempTHS[0].point == 14 && tempTHS[tempTHSsize - 1].point == 2\
&& &&& &&& &&&tempTHS[tempTHSsize - 2].point == 3\
&& &&& &&& &&&tempTHS[tempTHSsize - 3].point == 4\
&& &&& &&& &&&tempTHS[tempTHSsize - 4].point == 5\
&& &&& &&& &&&tempTHS[0].color == tempTHS[tempTHSsize - 1].color\
&& &&& &&& &&&tempTHS[tempTHSsize - 1].color == tempTHS[tempTHSsize - 2].color\
&& &&& &&& &&&tempTHS[tempTHSsize - 2].color == tempTHS[tempTHSsize - 3].color\
&& &&& &&& &&&tempTHS[tempTHSsize - 3].color == tempTHS[tempTHSsize - 4].color)
&& &&& &&& &tempTHSFive[0].point = 14;
&& &&& &&& &tempTHSFive[0].color = tempTHS[0].
&& &&& &&& &tempTHSFive[1].point = 5;
&& &&& &&& &tempTHSFive[1].color = tempTHS[0].
&& &&& &&& &tempTHSFive[2].point = 4;
&& &&& &&& &tempTHSFive[2].color = tempTHS[0].
&& &&& &&& &tempTHSFive[3].point = 3;
&& &&& &&& &tempTHSFive[3].color = tempTHS[0].
&& &&& &&& &tempTHSFive[4].point = 2;
&& &&& &&& &tempTHSFive[4].color = tempTHS[0].
&& &&& &&& &return calculTongHuaShun(tempTHSFive);
&& &//是否有四条
&& &card tST[5];
&& &for (int i = 0; i&4; i++)
&& &&& &if (tsc[i].point == tsc[i + 1].point\
&& &&& &&& &&&tsc[i + 1].point == tsc[i + 2].point\
&& &&& &&& &&&tsc[i + 2].point == tsc[i + 3].point)
&& &&& &&& &for (int j = j&i + 4; j++)
&& &&& &&& &{
&& &&& &&& &&& &tST[j - i].point = tsc[j].
&& &&& &&& &&& &tST[j - i].color = tsc[j].
&& &&& &&& &}
&& &&& &&& &if (i == 0)
&& &&& &&& &{
&& &&& &&& &&& &tST[4].point = tsc[4].
&& &&& &&& &&& &tST[4].color = tsc[4].
&& &&& &&& &}
&& &&& &&& &else
&& &&& &&& &{
&& &&& &&& &&& &tST[4].point = tsc[0].
&& &&& &&& &&& &tST[4].color = tsc[0].
&& &&& &&& &}
&& &&& &&& &sortCards(tST, 4);
&& &&& &&& &return calculSiTiao(tST);
&& &//是否有葫芦
&& &card tHL[5];
&& &&& &//找出第一个三条4333;
&& &&& &int kHL = 0, HLflag = 0;
&& &&& &for (int i = 0; i&5; i++)
&& &&& &&& &if (tsc[i].point == tsc[i + 1].point&&\
&& &&& &&& &&& &tsc[i + 1].point == tsc[i + 2].point)
&& &&& &&& &{
&& &&& &&& &&& &for (int j = j&i + 3; j++)
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tHL[j - i].point = tsc[j].
&& &&& &&& &&& &&& &tHL[j - i].color = tsc[j].
&& &&& &&& &&& &}
&& &&& &&& &&& &kHL =& //用来记录三条的位置
&& &&& &&& &&& &HLflag++; //表示找到了三条
&& &&& &&& &&& && //找到第一个三条就跳出循环 4333222;
&& &&& &&& &}
&& &&& &//找出第一个一对;3;
&& &&& &for (int i = 0; i&6; i++)
&& &&& &&& &if (tsc[i].point == tsc[i + 1].point\
&& &&& &&& &&& &&&tsc[i].point != tsc[kHL].point)
&& &&& &&& &{
&& &&& &&& &&& &for (int j = j&i + 2; j++)
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tHL[j - i + 3].point = tsc[j].
&& &&& &&& &&& &&& &tHL[j - i + 3].color = tsc[j].
&& &&& &&& &&& &}
&& &&& &&& &&& &HLflag++;& //表示找到了一对
&& &&& &&& &&& &
&& &&& &&& &}
&& &&& &if (HLflag == 2)
&& &&& &&& &sortCards(tHL, 5);
&& &&& &&& &return& calculLuHua(tHL);
&& &//是否有同花
&& &card tTH[5];
&& &card tTH6[6];
&& &//@@@@@@@@@@@@@2
&& &card tTHC[7];
&& &for (int i = 0; i&7; i++)
&& &&& &tTHC[i].point = seven[i].
&& &&& &tTHC[i].color = seven[i].
&& &sortCardsColor(tTHC, 7); //分三种情况,5张同花,6张同花,7张同花
&& &//找到同花的数目
&& &int sameColorNumber = 1;
&& &for (int i = 0; i & 6; i++)
&& &&& &if (tTHC[i].color == tTHC[i + 1].color)
&& &&& &&& &sameColorNumber++;
&& &&& &else
&& &&& &&& &if (sameColorNumber & 5)
&& &&& &&& &{
&& &&& &&& &&& &sameColorNumber = 1;
&& &&& &&& &&& &
&& &&& &&& &}
&& &&& &&& &else
&& &&& &&& &{
&& &&& &&& &&& &
&& &&& &&& &}
&& &if (sameColorNumber == 5)
&& &&& &for (int i = 0; i & 3; i++)
&& &&& &&& &if (tTHC[i].color == tTHC[i + 1].color\
&& &&& &&& &&& &&&tTHC[i + 1].color == tTHC[i + 2].color\
&& &&& &&& &&& &&&tTHC[i + 2].color == tTHC[i + 3].color\
&& &&& &&& &&& &&&tTHC[i + 3].color == tTHC[i + 4].color)
&& &&& &&& &{
&& &&& &&& &&& &for (int j = j & i + 5; j++)
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tTH[j - i].point = tTHC[j].
&& &&& &&& &&& &&& &tTH[j - i].color = tTHC[j].
&& &&& &&& &&& &}
&& &&& &&& &&& &sortCards(tTH, 5);
&& &&& &&& &&& &return calculTongHua(tTH);
&& &&& &&& &}
&& &else if (sameColorNumber == 6)
&& &&& &if (tTHC[0].color == tTHC[1].color)& //2222223
&& &&& &&& &for (int ti = 0; ti & 6; ti++)
&& &&& &&& &{
&& &&& &&& &&& &tTH6[ti].point = tTHC[ti].
&& &&& &&& &&& &tTH6[ti].color = tTHC[ti].
&& &&& &&& &}
&& &&& &&& &sortCards(tTH6, 6);&& //取出最大的5张同花
&& &&& &&& &for (int si = 0; si & 5; si++)
&& &&& &&& &{
&& &&& &&& &&& &tTH[si].point = tTH6[si].
&& &&& &&& &&& &tTH[si].color = tTH6[si].
&& &&& &&& &}
&& &&& &&& &return calculTongHua(tTH);
&& &&& &else
&& &&& &&& &for (int ti = 1; ti & 7; ti++)
&& &&& &&& &{
&& &&& &&& &&& &tTH6[ti - 1].point = tTHC[ti].
&& &&& &&& &&& &tTH6[ti - 1].color = tTHC[ti].
&& &&& &&& &}
&& &&& &&& &sortCards(tTH6, 6);&& //取出最大的5张同花
&& &&& &&& &for (int si = 0; si & 5; si++)
&& &&& &&& &{
&& &&& &&& &&& &tTH[si].point = tTH6[si].
&& &&& &&& &&& &tTH[si].color = tTH6[si].
&& &&& &&& &}
&& &&& &&& &return calculTongHua(tTH);
&& &else if (sameColorNumber == 7)
&& &&& &sortCards(tTHC, 7);
&& &&& &for (int ki = 0; ki & 5; ki++)
&& &&& &&& &tTH[ki].point = tTHC[ki].
&& &&& &&& &tTH[ki].color = tTHC[ki].
&& &&& &return calculTongHua(tTH);
&& &//是否有顺子
&& &card tSZ[5];
&& &int tempSZpoint = 0, tempSZsize = 1;
&& &card tempSZFive[5];
&& &card tempSZ[7];
&& &&& &tempSZpoint = tsc[0].
&& &&& &tempSZ[0].point = tsc[0].
&& &&& &tempSZ[0].color = tsc[0].
&& &//去重 9987654.
&& &for (int i = 1; i&7; i++)
&& &&& &if (tempSZpoint != tsc[i].point)
&& &&& &&& &tempSZpoint = tsc[i].
&& &&& &&& &tempSZ[tempSZsize].point = tsc[i].
&& &&& &&& &tempSZ[tempSZsize].color = tsc[i].
&& &&& &&& &tempSZsize++;
&& &if (tempSZsize &= 5) //表示去重之后还有至少5张牌
&& &&& &sortCards(tempSZ, tempSZsize);
&& &&& &//进行是否是顺子的判断,除了A5432
&& &&& &for (int i = 0; i &= tempSZsize - 5; i++)
&& &&& &&& &if (tempSZ[i].point == tempSZ[i + 1].point + 1\
&& &&& &&& &&& &&&tempSZ[i + 1].point == tempSZ[i + 2].point + 1\
&& &&& &&& &&& &&&tempSZ[i + 2].point == tempSZ[i + 3].point + 1\
&& &&& &&& &&& &&&tempSZ[i + 3].point == tempSZ[i + 4].point + 1)
&& &&& &&& &{
&& &&& &&& &&& &for (int kk = kk&i + 5; kk++)
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tSZ[kk - i].point = tempSZ[kk].
&& &&& &&& &&& &&& &tSZ[kk - i].color = tempSZ[kk].
&& &&& &&& &&& &}
&& &&& &&& &&& &sortCards(tSZ, 5);
&& &&& &&& &&& &return calculShunZi(tSZ);
&& &&& &&& &}
&& &&& &}//跳出for,寻找是否有A5432
&& &&& &if (tempSZ[0].point == 14\
&& &&& &&& &&&tempSZ[tempSZsize - 1].point == 2\
&& &&& &&& &&&tempSZ[tempSZsize - 2].point == 3\
&& &&& &&& &&&tempSZ[tempSZsize - 3].point == 4\
&& &&& &&& &&&tempSZ[tempSZsize - 4].point == 5)
&& &&& &&& &tempSZFive[0].point = 14;
&& &&& &&& &tempSZFive[0].color = tempSZ[0].
&& &&& &&& &tempSZFive[1].point = 5;
&& &&& &&& &tempSZFive[1].color = tempSZ[0].
&& &&& &&& &tempSZFive[2].point = 4;
&& &&& &&& &tempSZFive[2].color = tempSZ[0].
&& &&& &&& &tempSZFive[3].point = 3;
&& &&& &&& &tempSZFive[3].color = tempSZ[0].
&& &&& &&& &tempSZFive[4].point = 2;
&& &&& &&& &tempSZFive[4].color = tempSZ[0].
&& &&& &&& &return calculShunZi(tempSZFive);
&& &//是否有三条
&& &card tSST[5];
&& &int kSST = 0;
&& &for (int i = 0; i&5; i++)
&& &&& &if (tsc[i].point == tsc[i + 1].point\
&& &&& &&& &&&tsc[i + 1].point == tsc[i + 2].point)
&& &&& &&& &kSST =//记录三条的位置
&& &&& &&& &for (int j = j&i + 3; j++)
&& &&& &&& &{
&& &&& &&& &&& &tSST[j - i].point = tsc[j].
&& &&& &&& &&& &tSST[j - i].color = tsc[j].
&& &&& &&& &}
&& &&& &&& &switch (kSST)
&& &&& &&& &{
&& &&& &&& &&& &//9998765
&& &&& &&& &case 0:tSST[3].point = tsc[3]. tSST[3].color = tsc[3].
&& &&& &&& &&& &tSST[4].point = tsc[4]. tSST[4].color = tsc[4].
&& &&& &&& &&& &
&& &&& &&& &&& &//9888765
&& &&& &&& &case 1:tSST[3].point = tsc[0]. tSST[3].color = tsc[0].
&& &&& &&& &&& &tSST[4].point = tsc[4]. tSST[4].color = tsc[4].
&& &&& &&& &&& &
&& &&& &&& &&& &//;
&& &&& &&& &default:tSST[3].point = tsc[0]. tSST[3].color = tsc[0].
&& &&& &&& &&& &tSST[4].point = tsc[1]. tSST[4].color = tsc[1].
&& &&& &&& &&& &
&& &&& &&& &}
&& &&& &&& &sortCards(tSST, 5);
&& &&& &&& &return calculSanTiao(tSST);
&& &//是否有两对
&& &card tLD[5];
&& &&& &int tmaxflag = 0, tminflag = 0;
&& &&& &int tLDflag = 0;
&& &&& &for (int i = 0; i&7; i++)
&& &&& &&& &if (tsc[i].point == tsc[i + 1].point)& //找到第一个大对
&& &&& &&& &{
&& &&& &&& &&& &tLDflag++;
&& &&& &&& &&& &tmaxflag =
&& &&& &&& &&& &for (int j = j&i + 2; j++)
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tLD[j - i].point = tsc[j].
&& &&& &&& &&& &&& &tLD[j - i].color = tsc[j].
&& &&& &&& &&& &}
&& &&& &&& &&& &
&& &&& &&& &}
&& &&& &if (tLDflag == 1)& //找到了第一个大对
&& &&& &&& &for (int m = tmaxflag + 2; m&7 - 1; m++)
&& &&& &&& &{
&& &&& &&& &&& &if (tsc[m].point == tsc[m + 1].point) //找到第二个对子
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tLDflag++;
&& &&& &&& &&& &&& &tminflag =
&& &&& &&& &&& &&& &for (int jm = jm&m + 2; jm++)
&& &&& &&& &&& &&& &{
&& &&& &&& &&& &&& &&& &tLD[jm - m + 2].point = tsc[jm].
&& &&& &&& &&& &&& &&& &tLD[jm - m + 2].color = tsc[jm].
&& &&& &&& &&& &&& &}
&& &&& &&& &&& &&& &
&& &&& &&& &&& &}
&& &&& &&& &}
&& &&& &&& &if (tLDflag == 2) //表示找到了两对
&& &&& &&& &{
&& &&& &&& &&& &//提取出最大的单牌
&& &&& &&& &&& &if (tminflag == 2 && tmaxflag == 0)& //9988765
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tLD[4].point = tsc[4].
&& &&& &&& &&& &&& &tLD[4].color = tsc[4].
&& &&& &&& &&& &}
&& &&& &&& &&& &else if (tmaxflag == 0 && tminflag - tmaxflag &= 3)//7655
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tLD[4].point = tsc[2].
&& &&& &&& &&& &&& &tLD[4].color = tsc[2].
&& &&& &&& &&& &}
&& &&& &&& &&& &else& //7665,deng
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tLD[4].point = tsc[0].
&& &&& &&& &&& &&& &tLD[4].color = tsc[0].
&& &&& &&& &&& &}
&& &&& &&& &&& &sortCards(tLD, 5);
&& &&& &&& &&& &return calculLiangDui(tLD);
&& &&& &&& &}
&& &//是否有一对
&& &card tYD[5];
&& &&& &for (int i = 0; i&6; i++)
&& &&& &&& &if (tsc[i].point == tsc[i + 1].point) //找到一对
&& &&& &&& &{
&& &&& &&& &&& &for (int j = j&i + 2; j++)
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &tYD[j - i].point = tsc[j].
&& &&& &&& &&& &&& &tYD[j - i].color = tsc[j].
&& &&& &&& &&& &}
&& &&& &&& &&& &switch (i)
&& &&& &&& &&& &{
&& &&& &&& &&& &&& &//9987654
&& &&& &&& &&& &case 0:{
&& &&& &&& &&& &&& &&& &&& for (int jj = 2; jj&2 + 3; jj++)
&& &&& &&& &&& &&& &&& &&& {
&& &&& &&& &&& &&& &&& &&& &&& tYD[jj].point = tsc[jj].
&& &&& &&& &&& &&& &&& &&& &&& tYD[jj].color = tsc[jj].
&& &&& &&& &&& &&& &&& &&& }
&& &&& &&& &&& &&& &&& &&&
&& &&& &&& &&& &}
&& &&& &&& &&& &&& &//9887654
&& &&& &&& &&& &case 1:{
&& &&& &&& &&& &&& &&& &&& tYD[2].point = tsc[0].
&& &&& &&& &&& &&& &&& &&& tYD[2].color = tsc[0].
&& &&& &&& &&& &&& &&& &&& for (int jj = 3; jj&3 + 2; jj++)
&& &&& &&& &&& &&& &&& &&& {
&& &&& &&& &&& &&& &&& &&& &&& tYD[jj].point = tsc[jj].
&& &&& &&& &&& &&& &&& &&& &&& tYD[jj].color = tsc[jj].
&& &&& &&& &&& &&& &&& &&& }
&& &&& &&& &&& &&& &&& &&&
&& &&& &&& &&& &}
&& &&& &&& &&& &&& &//9877654
&& &&& &&& &&& &case 2:{
&& &&& &&& &&& &&& &&& &&& tYD[2].point = tsc[4].
&& &&& &&& &&& &&& &&& &&& tYD[2].color = tsc[4].
&& &&& &&& &&& &&& &&& &&& for (int jj = 0; jj&2; jj++)
&& &&& &&& &&& &&& &&& &&& {
&& &&& &&& &&& &&& &&& &&& &&& tYD[jj + 3].point = tsc[jj].
&& &&& &&& &&& &&& &&& &&& &&& tYD[jj + 3].color = tsc[jj].
&& &&& &&& &&& &&& &&& &&& }
&& &&& &&& &&& &&& &&& &&&
&& &&& &&& &&& &}
&& &&& &&& &&& &&& &//;
&& &&& &&& &&& &default:{
&& &&& &&& &&& &&& &&& &&& &for (int jj = 0; jj&3; jj++)
&& &&& &&& &&& &&& &&& &&& &{
&& &&& &&& &&& &&& &&& &&& &&& &tYD[jj + 2].point = tsc[jj].
&& &&& &&& &&& &&& &&& &&& &&& &tYD[jj + 2].color = tsc[jj].
&& &&& &&& &&& &&& &&& &&& &}
&& &&& &&& &&& &&& &&& &&& &
&& &&& &&& &&& &}
&& &&& &&& &&& &}
&& &&& &&& &&& &sortCards(tYD, 5);
&& &&& &&& &&& &return calculYiDui(tYD);
&& &&& &&& &}
&& &//高牌
&& &card tGP[5];
&& &for (int i = 0; i&5; i++)
&& &&& &tGP[i].point = tsc[i].
&& &&& &tGP[i].color = tsc[i].
&& &return calculGaoPai(tGP);
//用到全局变量ALLCard
double predictMyFlopWinRate(int livePeopleNumber)
&&&//记录我与对手7张牌比较的结果
&&& //得到我的手牌加公牌
&&& card myFlop[7];
&&& for (int i = 0; i & 5; i++)
&&&&&&& myFlop[i].point = ALLCard[i].
&&&&&&& myFlop[i].color = ALLCard[i].
& //记录已有的公牌与模拟出的转牌与河牌
&&& card publicCard[5];
&&& for(int i=0;i&3;i++)
&&&&&&& publicCard[i].point=ALLCard[i+2].
&&&&&&& publicCard[i].color=ALLCard[i+2].
&&& //是否已模拟出转牌与河牌的标记
&&& int TRflag=0;
&&& //先随机出50000张牌;
&&& card mCard[RANDSIZE];
&&& produceNumbersCard(mCard,RANDSIZE);
&&& //分别储存已模拟的对手个数,已有牌的张数,一个对手手牌的张数
&&& int tempPeopleNum = 0, hadCardSize = 5, twoCardSize = 0;
&&& int counter = 0, effctCardNum = 0;
&&& card oneCard, twoCard[2];
&&& card hadCard[16+3+2];& //最多8个人,16+3+2张牌
&&& for (int i = 0; i & 5; i++) //把我的手牌与公牌加入到hadCard里面
&&&&&&& hadCard[i].point = ALLCard[i].
&&&&&&& hadCard[i].color = ALLCard[i].
&&& //储存敌人的7张牌
&&& card enemyCard[7];
&&& int flag2=0;
&&& //在随机出来的牌里模拟敌人的牌
&&& for (int i = 0; i & RANDSIZE; i++)
&&&&&&& oneCard = mCard[i];
&&&&&&& if (isInHadCards(oneCard, hadCard, hadCardSize))
&&&&&&&&&&&& //如果是已有的牌,则抛弃
&&&&&&& else
&&&&&&&&&&& //将一张牌放入twoCard中
&&&&&&&&&&& twoCard[twoCardSize].point = oneCard.
&&&&&&&&&&& twoCard[twoCardSize].color = oneCard.
&&&&&&&&&&& twoCardSize++;
&&&&&&&&&&& //把产生的牌放入hadCard中
&&&&&&&&&&& hadCard[hadCardSize].point = oneCard.
&&&&&&&&&&& hadCard[hadCardSize].color = oneCard.
&&&&&&&&&&& hadCardSize++;
&&&&&&&&&&& //如果只产生了一张合理的手牌,则继续产生
&&&&&&&&&&& if (twoCardSize != 2)
&&&&&&&&&&&&&&&
&&&&&&&&&&& else
&&&&&&&&&&& {
&&&&&&&&&&&&&&& if(TRflag==0)& //表示还没有产生河牌与转牌
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& //加入到公牌里
&&&&&&&&&&&&&&&&&&& for(int mm=0;mm&2;mm++)
&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&& publicCard[mm+3].point=twoCard[mm].
&&&&&&&&&&&&&&&&&&&&&&& publicCard[mm+3].color=twoCard[mm].
&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&& //加入到我的7张牌里
&&&&&&&&&&&&&&&&&&& for(int mm=0;mm&2;mm++)
&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&& myFlop[mm+5].point=twoCard[mm].
&&&&&&&&&&&&&&&&&&&&&&& myFlop[mm+5].color=twoCard[mm].
&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&& twoCardSize=0;
&&&&&&&&&&&&&&&&&&& //修改标志,表示已模拟出转牌与河牌
&&&&&&&&&&&&&&&&&&& TRflag=1;
&&&&&&&&&&&&&&&&&&&& //再模拟两张,作为敌人的手牌
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& //表示已产生转牌与河牌,则将产生的两张牌作为敌人的手牌
&&&&&&&&&&&&&&& tempPeopleNum++;& //产生了两张合理的牌,则表示产生了一名对手的牌
&&&&&&&&&&&&&&& //将5张公牌加入到敌人的手牌里
&&&&&&&&&&&&&&& for(int mj=0;mj&5;mj++)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& enemyCard[mj].point=publicCard[mj].
&&&&&&&&&&&&&&&&&&& enemyCard[mj].color=publicCard[mj].
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& //将产生的两张牌加入到敌人的牌里
&&&&&&&&&&&&&&& for (int mi = 0; mi&2; mi++)
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& enemyCard[mi + 5].point = twoCard[mi].
&&&&&&&&&&&&&&&&&&& enemyCard[mi + 5].color = twoCard[mi].
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& twoCardSize = 0;
&&&&&&&&&&&&&&& //flag=compar7Card(myFlop,enemyCard);
&&&&&&&&&&&&&&& long m1=mycalcul7Card(myFlop);
&&&&&&&&&&&&&&& long m2=mycalcul7Card(enemyCard);
&&&&&&&&&&&&&&& if(m1&=m2)
&&&&&&&&&&&&&&&&&&& flag=2;
&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&&& flag=0;
&&&&&&&&&&&&&&& //模拟的手牌数清零
&&&&&&&&&&&&&&& if (flag==0)& //敌人大
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& effctCardNum++;
&&&&&&&&&&&&&&&&&&& tempPeopleNum = 0;& //表示下一轮模拟开始
&&&&&&&&&&&&&&&&&&& for (int jj = 5; jj& 16 + 3+2; jj++)
&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&& hadCard[jj].point = 0;
&&&&&&&&&&&&&&&&&&&&&&& hadCard[jj].color = 0;
&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&& flag2=0;
&&&&&&&&&&&&&&&&&&& hadCardSize = 5;
&&&&&&&&&&&&&&&&&&& TRflag=0;& //将公牌里面的河牌与转牌去掉
&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&& flag2=flag2+2; //test
&&&&&&&&&&&&&&&&&&& if(tempPeopleNum!=livePeopleNumber) //还没有模拟一轮
&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&& if(flag2==2*livePeopleNumber)//test
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& counter++;
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& tempPeopleNum=0;
&&&&&&&&&&&&&&&&&&&&&&& effctCardNum++;& //模拟的轮数加一
&&&&&&&&&&&&&&&&&&&&&&& for (int jm = 5; jm& 16 + 3+2; jm++) //已有的牌里只保留我的手牌与公牌
&&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&&& hadCard[jm].point = 0;
&&&&&&&&&&&&&&&&&&&&&&&&&&& hadCard[jm].color = 0;
&&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&&& flag2=0;//test
&&&&&&&&&&&&&&&&&&&&&&& hadCardSize = 5;
&&&&&&&&&&&&&&&&&&&&&&& TRflag=0;& //将公牌里面的河牌与转牌去掉
&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&& }
&&&&&&&&&&& }
&&& return double(counter)/(double(effctCardNum));
double predictMyTurnWinRate(int livePeopleNumber)
&&//记录我与对手7张牌比较的结果
&& //得到我的手牌加公牌加转牌加河牌
&& card myTurn[7];
&& for (int i = 0; i & 6; i++)
&&&&&& myTurn[i].point = ALLCard[i].
&&&&&& myTurn[i].color = ALLCard[i].
&//记录已有的公牌与模拟出河牌
&& card publicCard[5];
&& for(int i=0;i&4;i++)
&&&&&& publicCard[i].point=ALLCard[i+2].
&&&&&& publicCard[i].color=ALLCard[i+2].
&& //是否已模拟出转牌与河牌的标记
&& int TRflag=0;
&& //先随机出50000张牌;
&& card mCard[RANDSIZE];
&& produceNumbersCard(mCard,RANDSIZE);
&& //分别储存已模拟的对手个数,已有牌的张数,一个对手手牌的张数
&& int tempPeopleNum = 0, hadCardSize = 6, twoCardSize = 0;
&& int counter = 0, effctCardNum = 0;
&& card oneCard, twoCard[2];
&& card hadCard[16+3+2+1];& //最多8个人,16+3+2+1张牌
&& for (int i = 0; i & 6; i++) //把我的手牌与公牌加入到hadCard里面
&&&&&& hadCard[i].point = ALLCard[i].
&&&&&& hadCard[i].color = ALLCard[i].
&& //储存敌人的7张牌
&& card enemyCard[7];
&& int flag2=0;
&& //在随机出来的牌里模拟敌人的牌
&& for (int i = 0; i & RANDSIZE; i++)
&&&&&& oneCard = mCard[i];
&&&&&& if (isInHadCards(oneCard, hadCard, hadCardSize))
&&&&&&&&&&& //如果是已有的牌,则抛弃
&&&&&& else
&&&&&&&&&& //将一张牌放入twoCard中
&&&&&&&&&& twoCard[twoCardSize].point = oneCard.
&&&&&&&&&& twoCard[twoCardSize].color = oneCard.
&&&&&&&&&& twoCardSize++;
&&&&&&&&&& //把产生的牌放入hadCard中
&&&&&&&&&& hadCard[hadCardSize].point = oneCard.
&&&&&&&&&& hadCard[hadCardSize].color = oneCard.
&&&&&&&&&& hadCardSize++;
&&&&&&&&&& //如果只产生了一张合理的手牌,则继续产生
&&&&&&&&&& if (twoCardSize != 2)
&&&&&&&&&&&&&&
&&&&&&&&&& else
&&&&&&&&&& {
&&&&&&&&&&&&&& if(TRflag==0)& //表示还没有产生河牌
&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&& //取一张牌加入到公牌里
&&&&&&&&&&&&&&&&&&&&&& publicCard[4].point=twoCard[0].
&&&&&&&&&&&&&&&&&&&&&& publicCard[4].color=twoCard[0].
&&&&&&&&&&&&&&&&&& //加入到我的7张牌里
&&&&&&&&&&&&&&&&&&&&&& myTurn[6].point=twoCard[0].
&&&&&&&&&&&&&&&&&&&&&& myTurn[6].color=twoCard[0].
&&&&&&&&&&&&&&&&&& twoCardSize=0;
&&&&&&&&&&&&&&&&&& //修改标志,表示已模拟出转牌与河牌
&&&&&&&&&&&&&&&&&& TRflag=1;
&&&&&&&&&&&&&&&&&&& //再模拟两张,作为敌人的手牌
&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& //表示已产生转牌与河牌,则将产生的两张牌作为敌人的手牌
&&&&&&&&&&&&&& tempPeopleNum++;& //产生了两张合理的牌,则表示产生了一名对手的牌
&&&&&&&&&&&&&& //将5张公牌加入到敌人的手牌里
&&&&&&&&&&&&&& for(int mj=0;mj&5;mj++)
&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&& enemyCard[mj].point=publicCard[mj].
&&&&&&&&&&&&&&&&&& enemyCard[mj].color=publicCard[mj].
&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& //将产生的两张牌加入到敌人的牌里
&&&&&&&&&&&&&& for (int mi = 0; mi&2; mi++)
&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&& enemyCard[mi + 5].point = twoCard[mi].
&&&&&&&&&&&&&&&&&& enemyCard[mi + 5].color = twoCard[mi].
&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& twoCardSize = 0;
&&&&&&&&&&&&&& //flag=compar7Card(myTurn,enemyCard);
&&&&&&&&&&&&&& long m1=mycalcul7Card(myTurn);
&&&&&&&&&&&&&& long m2=mycalcul7Card(enemyCard);
&&&&&&&&&&&&&& if(m1&=m2)
&&&&&&&&&&&&&&&&&& flag=2;
&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&& flag=0;
&&&&&&&&&&&&&& //模拟的手牌数清零
&&&&&&&&&&&&&& if (flag==0)& //敌人大
&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&& effctCardNum++;
&&&&&&&&&&&&&&&&&& tempPeopleNum = 0;& //表示下一轮模拟开始
&&&&&&&&&&&&&&&&&& for (int jj = 6; jj& 16 + 3+2+1; jj++)
&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&& hadCard[jj].point = 0;
&&&&&&&&&&&&&&&&&&&&&& hadCard[jj].color = 0;
&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&& flag2=0;
&&&&&&&&&&&&&&&&&& hadCardSize = 6;
&&&&&&&&&&&&&&&&&& TRflag=0;& //将公牌里面的河牌与转牌去掉
&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& else
&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&& flag2=flag2+2;
&&&&&&&&&&&&&&&&&& if(tempPeopleNum!=livePeopleNumber) //还没有模拟一轮
&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&& if(flag2==2*livePeopleNumber)
&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&& counter++;
&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&& tempPeopleNum=0;
&&&&&&&&&&&&&&&&&&&&&& effctCardNum++;& //模拟的轮数加一
&&&&&&&&&&&&&&&&&&&&&& for (int jm = 6; jm& 16 + 3+2+1; jm++) //已有的牌里只保留我的手牌与公牌
&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&& hadCard[jm].point = 0;
&&&&&&&&&&&&&&&&&&&&&&&&&& hadCard[jm].color = 0;
&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&& flag2=0;
&&&&&&&&&&&&&&&&&&&&&& hadCardSize = 6;
&&&&&&&&&&&&&&&&&&&&&& TRflag=0;& //将公牌里面的河牌与转牌去掉
&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& }
&&&&&&&&&& }
&& return double(counter)/(double(effctCardNum));
double getMyRiverWinRate(int livePeopleNumber)
&&//记录我与对手5张牌比较的结果
&& //得到我的手牌加公牌加转牌
&& card myRiver[7];
&& for (int i = 0; i & 7; i++)
&&&&&&& myRiver[i].point = ALLCard[i].
&&&&&&& myRiver[i].color = ALLCard[i].
&& //先随机出50000张牌;
&& card mCard[RANDSIZE];
&& produceNumbersCard(mCard,RANDSIZE);
&& //分别储存已模拟的对手个数,已有牌的张数,一个对手手牌的张数
&& int tempPeopleNum = 0, hadCardSize = 7, twoCardSize = 0;
&& int counter = 0, effctCardNum = 0;
&& card oneCard, twoCard[2];
&& card hadCard[16+3+1+1];& //最多8个人,16+3+2张牌
&& for (int i = 0; i & 7; i++) //把我的手牌与公牌与转牌加入到hadCard里面
&&&&&& hadCard[i].point = ALLCard[i].
&&&&&& hadCard[i].color = ALLCard[i].
&& //将公牌加入到对手的牌里
&& card enemyCard[7];
&&& int flag2=0;
&& //在随机出来的牌里模拟敌人的牌
&& for (int i = 0; i & RANDSIZE; i++)
&&&&&& oneCard = mCard[i];
&&&&&& if (isInHadCards(oneCard, hadCard, hadCardSize))
&&&&&&&&&&& //如果是已有的牌,则抛弃
&&&&&& else
&&&&&&&&&& //将一张牌放入twoCard中
&&&&&&&&&& twoCard[twoCardSize].point = oneCard.
&&&&&&&&&& twoCard[twoCardSize].color = oneCard.
&&&&&&&&&& twoCardSize++;
&&&&&&&&&& //把产生的牌放入hadCard中
&&&&&&&&&& hadCard[hadCardSize].point = oneCard.
&&&&&&&&&& hadCard[hadCardSize].color = oneCard.
&&&&&&&&&& hadCardSize++;
&&&&&&&&&& //如果只产生了一张合理的手牌,则继续产生
&&&&&&&&&& if (twoCardSize != 2)
&&&&&&&&&&&&&&
&&&&&&&&&& else
&&&&&&&&&& {
&&&&&&&&&&&&&& tempPeopleNum++;& //产生了两张合理的牌,则表示产生了一名对手的牌
&&&&&&&&&&&&&& //把公牌放在敌人的手牌里
&&&&&&&&&&&&&& for (int j = 0; j & 5;j++)
&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&& enemyCard[j].point = ALLCard[j + 2].
&&&&&&&&&&&&&&&&&& enemyCard[j].color = ALLCard[j + 2].
&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& //将产生的两张牌加入到敌人的牌里
&&&&&&&&&&&&&& for (int mi = 0; mi&2; mi++)
&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&& enemyCard[mi + 5].point = twoCard[mi].
&&&&&&&&&&&&&&&&&& enemyCard[mi + 5].color = twoCard[mi].
&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& //flag=compar7Card(myRiver,enemyCard);
&&&&&&&&&&&&&& //!!!!!!!!!!!!!!
&&&&&&&&&&&&&& long m1=mycalcul7Card(myRiver);
&&&&&&&&&&&&&& long m2=mycalcul7Card(enemyCard);
&&&&&&&&&&&&&& if(m1&=m2)
&&&&&&&&&&&&&&&&&& flag=2;
&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&& flag=0;
&&&&&&&&&&&&&& twoCardSize = 0;& //模拟的手牌数清零
&&&&&&&&&&&&&& if (flag==0)& //敌人大
&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&& effctCardNum++;
&&&&&&&&&&&&&&&&&& tempPeopleNum = 0;& //表示下一轮模拟开始
&&&&&&&&&&&&&&&&&& for (int jj = 7; jj& 16 + 3+1+1; jj++)
&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&& hadCard[jj].point = 0;
&&&&&&&&&&&&&&&&&&&&&& hadCard[jj].color = 0;
&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&& flag2=0;//test
&&&&&&&&&&&&&&&&&& hadCardSize = 7;
&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& else
&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&& flag2=flag2+2;
&&&&&&&&&&&&&&&&&& if(tempPeopleNum!=livePeopleNumber) //还没有模拟一轮
&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&& else
&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&& if(flag2==2*livePeopleNumber)
&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&& counter++;
&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&& tempPeopleNum=0;
&&&&&&&&&&&&&&&&&&&&&& effctCardNum++;& //模拟的轮数加一
&&&&&&&&&&&&&&&&&&&&&& for (int jm = 7; jm& 16 + 3+1+1; jm++) //已有的牌里只保留我的手牌与公牌
&&&&&&&&&&&&&&&&&&&&&& {
&&&&&&&&&&&&&&&&&&&&&&&&&& hadCard[jm].point = 0;
&&&&&&&&&&&&&&&&&&&&&&&&&& hadCard[jm].color = 0;
&&&&&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&&&&&&&&&& flag2=0;
&&&&&&&&&&&&&&&&&&&&&& hadCardSize = 7;
&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&& }
&&&&&&&&&&&&&& }
&&&&&&&&&& }
&& return double(counter)/(double(effctCardNum));
据实践。模拟3000次左右,就已经可以稳定下来,再增加模拟次数,也没什么意义
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:4278次
排名:千里之外
原创:20篇
(4)(2)(2)(6)(1)(6)

我要回帖

更多关于 德州扑克规则 的文章

 

随机推荐