Files
2026-02-13 14:34:15 +08:00

7437 lines
260 KiB
C++

#include "StdAfx.h"
#include "GameLogic.h"
void CGameLogic::TheBestCard(tagAnalyseType tagCardType, BYTE btHandCardData[], BYTE btHandCardCount, BYTE btFrontCard[], BYTE btMidCard[], BYTE btBackCard[])
{
if(btHandCardCount!=13)
{
return;
}
BYTE btCardCount=btHandCardCount;
BYTE btCardData[13];
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
BYTE btCardData1[13];
BYTE btCardData2[13];
ZeroMemory(btCardData1, sizeof(btCardData1));
ZeroMemory(btCardData2,sizeof(btCardData2));
BYTE btCardCount1=0;
BYTE btCardCount2=0;
BYTE FrontCard[3];
BYTE MidCard[5];
BYTE BackCard[5];
BYTE btAllShuiShu=0;
ZeroMemory(FrontCard,sizeof(FrontCard));
ZeroMemory(MidCard,sizeof(MidCard));
ZeroMemory(BackCard,sizeof(BackCard));
BYTE FrontFrontCard[3];
BYTE FrontMidCard[5];
BYTE FrontBackCard[5];
BYTE btFrontAllShuiShu=0;
ZeroMemory(FrontFrontCard,sizeof(FrontFrontCard));
ZeroMemory(FrontMidCard,sizeof(FrontMidCard));
ZeroMemory(FrontBackCard,sizeof(FrontBackCard));
bool bCycling=true;
bool bFront=false;
bool bMid=false;
bool bBack=false;
bool bFirst=true;
BYTE btFront=0;
BYTE btMid=0;
BYTE btBack=0;
tagAnalyseType tagCardType1;
tagAnalyseType tagCardType2;
ZeroMemory(&tagCardType1,sizeof(tagCardType1));
ZeroMemory(&tagCardType2,sizeof(tagCardType2));
BYTE btTemp[13];
ZeroMemory(btTemp,sizeof(btTemp));
if(tagCardType.bStraightFlush) //有同花顺
{
for(int i=0;i<tagCardType.btStraightFlush;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<5;j++)
{
BackCard[j]=btCardData[tagCardType.cbStraightFlush[i*5+j]];
}
RemoveCard(BackCard,5,btCardData,btCardCount);
btCardCount1= btCardCount-=5;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bStraightFlush) //有同花顺
{
for(int j=0;j<tagCardType1.btStraightFlush;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraightFlush[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData1[k];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
else if(tagCardType1.bFourSame) //有铁支
{
for(int j=0;j<tagCardType1.btFourSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbFourSame[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //剩下三条
{
for(int k=3;k>=0;k--)
{
if(GetCardLogicValue(btCardData2[k])!=GetCardLogicValue(btCardData2[tagCardType2.cbThreeSame[0]]))
{
btTemp[0]=MidCard[4]=btCardData2[k];
break;
}
}
RemoveCard(btTemp,1,btCardData2,btCardCount2);
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
else if(tagCardType2.bTwoPare)//剩下两对
{
MidCard[4]=btCardData2[tagCardType2.cbTwoPare[3]];
FrontCard[0]=btCardData2[tagCardType2.cbTwoPare[0]];
FrontCard[1]=btCardData2[tagCardType2.cbTwoPare[1]];
FrontCard[2]=btCardData2[tagCardType2.cbTwoPare[2]];
}
else if(tagCardType2.bOnePare)//剩下一对
{
for(int k=3;k>=0;k--)
{
if(GetCardLogicValue(btCardData2[k])!=GetCardLogicValue(btCardData2[tagCardType2.cbOnePare[0]]))
{
btTemp[0]=MidCard[4]=btCardData2[k];
break;
}
}
RemoveCard(btTemp,1,btCardData2,btCardCount2);
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
else //剩下散牌
{
MidCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
else
{
if(tagCardType1.bGourd) //有葫芦
{
bool bThreeSame=false;
for(int j=0;j<tagCardType1.btThreeSame;j++) //前敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(FrontCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(MidCard,btCardData1,sizeof(btCardData1[0])*btCardCount2);
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
if(bThreeSame==false) //前敦不能为三条
{
for(int j=0;j<tagCardType1.btGourd;j++) //中敦葫芦
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbGourd[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
else if(tagCardType1.bFlush) //有同花
{
bool bThreeSame=false;
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //前敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(FrontCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(MidCard,btCardData1,sizeof(btCardData1[0])*btCardCount2);
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(bThreeSame==false) //前敦不能为三条
{
for(int j=0;j<tagCardType1.btFlush;j++) //中敦同花
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbFlush[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
if(tagCardType1.bStraight) //有顺子
{
for(int j=0;j<tagCardType1.btStraight;j++) //中敦顺子
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //中敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
MidCard[3]=btCardData1[3];
MidCard[4]=btCardData1[4];
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
}
else if(tagCardType1.bStraight) //有顺子
{
bool bThreeSame=false;
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //前敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(FrontCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(MidCard,btCardData1,sizeof(btCardData1[0])*btCardCount2);
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(bThreeSame==false) //前敦不能为三条
{
for(int j=0;j<tagCardType1.btStraight;j++) //中敦顺子
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //中敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
MidCard[3]=btCardData1[3];
MidCard[4]=btCardData1[4];
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
}
else if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //中敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
MidCard[3]=btCardData1[3];
MidCard[4]=btCardData1[4];
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
else if(tagCardType1.bTwoPare) //有两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++) //中敦两对
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //剩下两对
{
MidCard[4]=btCardData2[tagCardType2.cbTwoPare[3]];
FrontCard[0]=btCardData2[tagCardType2.cbTwoPare[0]];
FrontCard[1]=btCardData2[tagCardType2.cbTwoPare[1]];
FrontCard[2]=btCardData2[tagCardType2.cbTwoPare[2]];
}
else if(tagCardType2.bOnePare) //剩下一对
{
for(int k=3;k>=0;k--)
{
if(GetCardLogicValue(btCardData2[k])!=GetCardLogicValue(btCardData2[tagCardType2.cbOnePare[0]]))
{
btTemp[0]=MidCard[4]=btCardData2[k];
break;
}
}
RemoveCard(btTemp,1,btCardData2,btCardCount2);
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
else //剩下散牌
{
MidCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
else if(tagCardType1.bOnePare) //有一对
{
for(int j=0;j<tagCardType1.btOnePare;j++) //中敦一对
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
for(int k=0;k<6;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k-1]=btCardData2[k];
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
else //散牌
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
}
else if(tagCardType.bFourSame) //铁支
{
for(int i=0;i<tagCardType.btFourSame;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<4;j++)
{
BackCard[j]=btCardData[tagCardType.cbFourSame[i*4+j]];
}
RemoveCard(BackCard,4,btCardData,btCardCount);
btCardCount1= btCardCount-=4;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bFourSame) //有铁支
{
for(int j=0;j<tagCardType1.btFourSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbFourSame[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bFourSame) //剩下铁支
{
if(GetCardLogicValue(btCardData2[0])==GetCardLogicValue(btCardData2[1]))
{
BackCard[4]=btCardData2[4];
MidCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
else
{
BackCard[4]=btCardData2[0];
MidCard[4]=btCardData2[4];
CopyMemory(FrontCard,&btCardData2[1],sizeof(FrontCard));
}
}
else if(tagCardType2.bGourd) //剩下葫芦
{
BackCard[4]=btCardData2[tagCardType2.cbGourd[4]];
MidCard[4]=btCardData2[tagCardType2.cbGourd[3]];
FrontCard[0]=btCardData2[tagCardType2.cbGourd[0]];
FrontCard[1]=btCardData2[tagCardType2.cbGourd[1]];
FrontCard[2]=btCardData2[tagCardType2.cbGourd[2]];
}
else if(tagCardType2.bFlush) //剩下同花
{
BackCard[4]=btCardData2[tagCardType2.cbFlush[4]];
MidCard[4]=btCardData2[tagCardType2.cbFlush[3]];
FrontCard[0]=btCardData2[tagCardType2.cbFlush[0]];
FrontCard[1]=btCardData2[tagCardType2.cbFlush[1]];
FrontCard[2]=btCardData2[tagCardType2.cbFlush[2]];
}
else if(tagCardType2.bStraight) //剩下顺子
{
BackCard[4]=btCardData2[tagCardType2.cbStraight[4]];
MidCard[4]=btCardData2[tagCardType2.cbStraight[3]];
FrontCard[0]=btCardData2[tagCardType2.cbStraight[0]];
FrontCard[1]=btCardData2[tagCardType2.cbStraight[1]];
FrontCard[2]=btCardData2[tagCardType2.cbStraight[2]];
}
else if(tagCardType2.bThreeSame) //剩下三条
{
for(int k=0;k<3;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(btTemp,3,btCardData2,btCardCount2);
BackCard[4]=btCardData2[1];
MidCard[4]=btCardData2[0];
}
else if(tagCardType2.bTwoPare)//剩下两对
{
for(int k=4;k>=0;k--)
{
if(GetCardLogicValue(btCardData2[k])!=GetCardLogicValue(btCardData2[tagCardType2.cbTwoPare[0]])
&&GetCardLogicValue(btCardData2[k])!=GetCardLogicValue(btCardData2[tagCardType2.cbTwoPare[2]]))
{
btTemp[0]=BackCard[4]=btCardData2[k];
break;
}
}
//RemoveCard(btTemp,1,btCardData2,btCardCount2);
MidCard[4]=btCardData2[tagCardType2.cbTwoPare[3]];
FrontCard[0]=btCardData2[tagCardType2.cbTwoPare[0]];
FrontCard[1]=btCardData2[tagCardType2.cbTwoPare[1]];
FrontCard[2]=btCardData2[tagCardType2.cbTwoPare[2]];
}
else if(tagCardType2.bOnePare)//剩下一对
{
btTemp[0]=FrontCard[0]=btCardData2[tagCardType2.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData2[tagCardType2.cbOnePare[1]];
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
BackCard[4]=btCardData2[2];
MidCard[4]=btCardData2[1];
}
else //剩下散牌
{
BackCard[4]=btCardData2[4];
MidCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
else
{
if(tagCardType1.bGourd) //有葫芦
{
bool bThreeSame=false;
for(int j=0;j<tagCardType1.btThreeSame;j++) //前敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(FrontCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bGourd) //剩下葫芦
{
for(int k=0;k<5;k++)
{
btTemp[k]=MidCard[k]=btCardData2[tagCardType2.cbGourd[k]];
}
RemoveCard(btTemp,5,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else if(tagCardType2.bFlush) //剩下同花
{
for(int k=0;k<5;k++)
{
btTemp[k]=MidCard[k]=btCardData2[tagCardType2.cbFlush[k]];
}
RemoveCard(btTemp,5,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else if(tagCardType2.bStraight) //剩下顺子
{
for(int k=0;k<5;k++)
{
btTemp[k]=MidCard[k]=btCardData2[tagCardType2.cbStraight[k]];
}
RemoveCard(btTemp,5,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else if(tagCardType2.bThreeSame) //剩下三条
{
for(int k=0;k<3;k++)
{
btTemp[k]=MidCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(btTemp,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[4]=btCardData2[2];
}
else //其他
{
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData2[k];
}
BackCard[4]=btCardData2[5];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
if(bThreeSame==false) //前敦不能为三条
{
for(int j=0;j<tagCardType1.btGourd;j++) //中敦葫芦
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbGourd[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=5;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //剩下两对
{
BackCard[4]=btCardData2[tagCardType2.cbTwoPare[3]];
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
else if(tagCardType2.bOnePare) //剩下一对
{
for(int k=3;k>=0;k--)
{
if(GetCardLogicValue(btCardData2[k])!=GetCardLogicValue(btCardData2[tagCardType2.cbOnePare[0]]))
{
btTemp[0]=BackCard[4]=btCardData2[k];
break;
}
}
RemoveCard(btTemp,1,btCardData2,btCardCount2);
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
else //剩下散牌
{
BackCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
else if(tagCardType1.bFlush) //有同花
{
bool bThreeSame=false;
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //前敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(FrontCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bFlush) //剩下同花
{
for(int k=0;k<5;k++)
{
btTemp[k]=MidCard[k]=btCardData2[tagCardType2.cbFlush[k]];
}
RemoveCard(btTemp,5,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else if(tagCardType2.bStraight) //剩下顺子
{
for(int k=0;k<5;k++)
{
btTemp[k]=MidCard[k]=btCardData2[tagCardType2.cbStraight[k]];
}
RemoveCard(btTemp,5,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else //其他
{
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData2[k];
}
BackCard[4]=btCardData2[5];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(bThreeSame==false) //前敦不能为三条
{
for(int j=0;j<tagCardType1.btFlush;j++) //中敦同花
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbFlush[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=5;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //剩下两对
{
BackCard[4]=btCardData2[tagCardType2.cbTwoPare[3]];
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
else if(tagCardType2.bOnePare) //剩下一对
{
for(int k=3;k>=0;k--)
{
if(GetCardLogicValue(btCardData2[k])!=GetCardLogicValue(btCardData2[tagCardType2.cbOnePare[0]]))
{
btTemp[0]=BackCard[4]=btCardData2[k];
break;
}
}
RemoveCard(btTemp,1,btCardData2,btCardCount2);
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
else //剩下散牌
{
//这里有问题 zyy
BackCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
if(tagCardType1.bStraight) //有顺子
{
for(int j=0;j<tagCardType1.btStraight;j++) //中敦顺子
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=5;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //剩下两对
{
BackCard[4]=btCardData2[tagCardType2.cbTwoPare[3]];
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
else if(tagCardType2.bOnePare) //剩下一对
{
for(int k=3;k>=0;k--)
{
if(GetCardLogicValue(btCardData2[k])!=GetCardLogicValue(btCardData2[tagCardType2.cbOnePare[0]]))
{
btTemp[0]=BackCard[4]=btCardData2[k];
break;
}
}
RemoveCard(btTemp,1,btCardData2,btCardCount2);
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
else //剩下散牌
{
BackCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //中敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
MidCard[3]=btCardData1[3];
MidCard[4]=btCardData1[4];
btCardCount2=btCardCount1-=5;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
//剩下散牌
BackCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
}
else if(tagCardType1.bStraight) //有顺子
{
bool bThreeSame=false;
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //前敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(FrontCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bStraight) //剩下顺子
{
for(int k=0;k<5;k++)
{
btTemp[k]=MidCard[k]=btCardData2[tagCardType2.cbStraight[k]];
}
RemoveCard(btTemp,5,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else //其他
{
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData2[k];
}
BackCard[4]=btCardData2[5];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(bThreeSame==false) //前敦不能为三条
{
for(int j=0;j<tagCardType1.btStraight;j++) //中敦顺子
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=5;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //剩下两对
{
BackCard[4]=btCardData2[tagCardType2.cbTwoPare[3]];
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
else if(tagCardType2.bOnePare) //剩下一对
{
for(int k=3;k>=0;k--)
{
if(GetCardLogicValue(btCardData2[k])!=GetCardLogicValue(btCardData2[tagCardType2.cbOnePare[0]]))
{
btTemp[0]=BackCard[4]=btCardData2[k];
break;
}
}
RemoveCard(btTemp,1,btCardData2,btCardCount2);
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
else //剩下散牌
{
BackCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //中敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
MidCard[3]=btCardData1[3];
MidCard[4]=btCardData1[4];
btCardCount2=btCardCount1-=5;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
//剩下散牌
BackCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
}
else if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++) //中敦三条
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
MidCard[3]=btCardData1[3];
MidCard[4]=btCardData1[4];
BackCard[4]=btCardData1[5];
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
else if(tagCardType1.bTwoPare) //有两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
BackCard[4]=btCardData1[2];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++) //中敦两对
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //剩下两对
{
btTemp[0]=MidCard[4]=btCardData2[tagCardType2.cbTwoPare[3]];
btTemp[1]=FrontCard[0]=btCardData2[tagCardType2.cbTwoPare[0]];
btTemp[2]=FrontCard[1]=btCardData2[tagCardType2.cbTwoPare[1]];
btTemp[3]=FrontCard[2]=btCardData2[tagCardType2.cbTwoPare[2]];
RemoveCard(btTemp,4,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //剩下一对
{
btTemp[0]=FrontCard[0]=btCardData2[tagCardType2.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData2[tagCardType2.cbOnePare[1]];
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[4]=btCardData2[2];
}
else //剩下散牌
{
BackCard[4]=btCardData2[4];
MidCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
else if(tagCardType1.bOnePare) //有一对
{
for(int j=0;j<tagCardType1.btOnePare;j++) //中敦一对
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
BackCard[4]=btCardData2[6];
MidCard[2]=btCardData2[5];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[3];
CopyMemory(FrontCard,btCardData2,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
else //散牌
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
BackCard[4]=btCardData1[8];
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) && (btAllShuiShu>btFrontAllShuiShu
|| (CompareCard(FrontFrontCard, FrontCard, 3, 3, m_bClassicRule) && btAllShuiShu == btFrontAllShuiShu)))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
}
else if(tagCardType.bGourd) //有葫芦
{
bool bThreeSame=false;
for(int i=0;i<tagCardType.btThreeSame;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<3;j++)
{
FrontCard[j]=btCardData[tagCardType.cbThreeSame[i*3+j]];
}
RemoveCard(FrontCard,3,btCardData,btCardCount);
btCardCount1=btCardCount-=3;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bGourd) //有葫芦
{
for(int j=0;j<tagCardType1.btGourd;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
BackCard[k]=btCardData1[tagCardType1.cbGourd[j*5+k]];
}
RemoveCard(BackCard,5,btCardData1,btCardCount1);
CopyMemory(MidCard,btCardData1,sizeof(MidCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(tagCardType1.bFlush) //有同花
{
for(int j=0;j<tagCardType1.btFlush;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
BackCard[k]=btCardData1[tagCardType1.cbFlush[j*5+k]];
}
RemoveCard(BackCard,5,btCardData1,btCardCount1);
CopyMemory(MidCard,btCardData1,sizeof(MidCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(tagCardType1.bStraight) //有顺子
{
for(int j=0;j<tagCardType1.btStraight;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
BackCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(BackCard,5,btCardData1,btCardCount1);
CopyMemory(MidCard,btCardData1,sizeof(MidCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
BackCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(BackCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame)
{
for(int k=0;k<tagCardType2.btThreeSame;k++)
{
for(int m=0;m<3;m++)
{
MidCard[m]=btCardData2[tagCardType2.cbThreeSame[k*3+m]];
}
RemoveCard(MidCard,3,btCardData2,btCardCount2);
BackCard[3]=btCardData2[2];
BackCard[4]=btCardData2[3];
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
}
}
if(bThreeSame==false)
{
for(int i=0;i<tagCardType.btGourd;i++) //第三敦为葫芦
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<5;j++)
{
BackCard[j]=btCardData[tagCardType.cbGourd[i*5+j]];
}
RemoveCard(BackCard,5,btCardData,btCardCount);
btCardCount1=btCardCount-=5;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bGourd) //剩下葫芦
{
for(int j=0;j<tagCardType1.btGourd;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbGourd[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType1.bFlush) //剩下同花
{
for(int j=0;j<tagCardType1.btFlush;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbFlush[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType1.bStraight) //剩下顺子
{
for(int j=0;j<tagCardType1.btStraight;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType1.bThreeSame) //剩下三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //三条
{
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(FrontCard,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<2)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
}
else //散牌
{
for(int k=0;k<5;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else //散牌
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k+1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
}
else //散牌
{
for(int k=0;k<6;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k-1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
if(tagCardType.bFlush) //第三敦为同花
{
for(int i=0;i<tagCardType.btFlush;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<5;j++)
{
BackCard[j]=btCardData[tagCardType.cbFlush[i*5+j]];
}
RemoveCard(BackCard,5,btCardData,btCardCount);
btCardCount1=btCardCount-=5;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bFlush) //剩下同花
{
for(int j=0;j<tagCardType1.btFlush;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbFlush[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bStraight) //剩下顺子
{
for(int j=0;j<tagCardType1.btStraight;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bThreeSame) //剩下三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //三条
{
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(FrontCard,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<2)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
}
else //散牌
{
for(int k=0;k<5;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else //散牌
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k+1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
}
else //散牌
{
for(int k=0;k<6;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k-1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType.bStraight) //第三敦为顺子
{
for(int i=0;i<tagCardType.btStraight;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<5;j++)
{
BackCard[j]=btCardData[tagCardType.cbStraight[i*5+j]];
}
RemoveCard(BackCard,5,btCardData,btCardCount);
btCardCount1=btCardCount-=5;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bStraight) //剩下顺子
{
for(int j=0;j<tagCardType1.btStraight;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bThreeSame) //剩下三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //三条
{
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(FrontCard,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<2)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
}
else //散牌
{
for(int k=0;k<5;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else //散牌
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k+1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
}
else //散牌
{
for(int k=0;k<6;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k-1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType.bThreeSame) //第三敦为三条
{
for(int i=0;i<tagCardType.btThreeSame;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<3;j++)
{
BackCard[j]=btCardData[tagCardType.cbThreeSame[i*3+j]];
}
RemoveCard(BackCard,3,btCardData,btCardCount);
btCardCount1=btCardCount-=3;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bThreeSame) //剩下三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //三条
{
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(FrontCard,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[3]=btCardData2[2];
BackCard[4]=btCardData2[3];
}
else if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<2)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=BackCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
BackCard[3]=btCardData2[3];
BackCard[4]=btCardData2[4];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[3]=btCardData2[3];
MidCard[4]=btCardData2[4];
BackCard[3]=btCardData2[5];
BackCard[4]=btCardData2[6];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
BackCard[3]=btCardData1[2];
BackCard[4]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
BackCard[3]=btCardData2[0];
BackCard[4]=btCardData2[1];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[3]=btCardData2[2];
BackCard[4]=btCardData2[3];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[3]=btCardData2[4];
BackCard[4]=btCardData2[5];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[3]=btCardData2[4];
BackCard[4]=btCardData2[5];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[2]=btCardData2[3];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[5];
BackCard[3]=btCardData2[6];
BackCard[4]=btCardData2[7];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
BackCard[3]=btCardData1[8];
BackCard[4]=btCardData1[9];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType.bTwoPare) //第三敦为两对
{
if(tagCardType.btOnePare<4)
{
for(int i=0;i<tagCardType.btTwoPare;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<4;j++)
{
BackCard[j]=btCardData[tagCardType.cbTwoPare[i*4+j]];
}
RemoveCard(BackCard,4,btCardData,btCardCount);
btCardCount1=btCardCount-=4;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
BackCard[4]=btCardData1[2];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[4]=btCardData2[2];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[4]=btCardData2[4];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[4]=btCardData2[4];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[2]=btCardData2[3];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[5];
BackCard[4]=btCardData2[6];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
BackCard[4]=btCardData1[8];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else
{
if(tagCardType.btOnePare==4)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=BackCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=BackCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=BackCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[3]=BackCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[4]=MidCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[5]=MidCard[1]=btCardData[tagCardType.cbOnePare[3]];
btTemp[6]=MidCard[2]=btCardData[tagCardType.cbOnePare[4]];
btTemp[7]=MidCard[3]=btCardData[tagCardType.cbOnePare[5]];
RemoveCard(btTemp,8,btCardData,btCardCount);
FrontCard[0]=btCardData[0];
FrontCard[1]=btCardData[1];
FrontCard[2]=btCardData[2];
MidCard[4]=btCardData[3];
BackCard[4]=btCardData[4];
if(GetCardLogicValue(FrontCard[0])==14&&GetCardLogicValue(FrontCard[1])==13)
{
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
else
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=BackCard[0]=btCardData[tagCardType.cbOnePare[4]];
btTemp[1]=BackCard[1]=btCardData[tagCardType.cbOnePare[5]];
btTemp[2]=BackCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[3]=BackCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[4]=MidCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[5]=MidCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[6]=FrontCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[7]=FrontCard[1]=btCardData[tagCardType.cbOnePare[3]];
RemoveCard(btTemp,8,btCardData,btCardCount);
FrontCard[2]=btCardData[0];
MidCard[2]=btCardData[1];
MidCard[3]=btCardData[2];
MidCard[4]=btCardData[3];
BackCard[4]=btCardData[4];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType.btOnePare==5)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=FrontCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData[tagCardType.cbOnePare[4]];
btTemp[3]=MidCard[1]=btCardData[tagCardType.cbOnePare[5]];
btTemp[4]=MidCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[5]=MidCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[6]=BackCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[7]=BackCard[1]=btCardData[tagCardType.cbOnePare[3]];
btTemp[8]=BackCard[2]=btCardData[tagCardType.cbOnePare[8]];
btTemp[9]=BackCard[3]=btCardData[tagCardType.cbOnePare[9]];
RemoveCard(btTemp,10,btCardData,btCardCount);
FrontCard[2]=btCardData[0];
MidCard[4]=btCardData[1];
BackCard[4]=btCardData[2];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
if(tagCardType.bOnePare) //第三敦为一对
{
for(int i=0;i<tagCardType.btOnePare;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<2;j++)
{
BackCard[j]=btCardData[tagCardType.cbOnePare[i*2+j]];
}
RemoveCard(BackCard,2,btCardData,btCardCount);
btCardCount1=btCardCount-=2;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[2]=btCardData2[4];
BackCard[3]=btCardData2[5];
BackCard[4]=btCardData2[6];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[2]=btCardData2[3];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[5];
BackCard[2]=btCardData2[6];
BackCard[3]=btCardData2[7];
BackCard[4]=btCardData2[8];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
// for(int m=0;m<3;m++)
// {
// printf("FrontFrontCard[%d]=%d ",m,FrontFrontCard[m]);
// }
// for(int m=0;m<5;m++)
// {
// printf("FrontMidCard[%d]=%d ",m,FrontMidCard[m]);
// }
// for(int m=0;m<5;m++)
// {
// printf("FrontBackCard[%d]=%d ",m,FrontBackCard[m]);
// }
// printf("\n");
// for(int m=0;m<3;m++)
// {
// printf("FrontCard[%d]=%d ",m,FrontCard[m]);
// }
// for(int m=0;m<5;m++)
// {
// printf("MidCard[%d]=%d ",m,MidCard[m]);
// }
// for(int m=0;m<5;m++)
// {
// printf("BackCard[%d]=%d ",m,BackCard[m]);
// }
// printf("\n");
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
BackCard[2]=btCardData1[8];
BackCard[3]=btCardData1[9];
BackCard[4]=btCardData1[10];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
}
else if(tagCardType.bFlush) //有同花
{
bool bThreeSame=false;
for(int i=0;i<tagCardType.btThreeSame;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<3;j++)
{
FrontCard[j]=btCardData[tagCardType.cbThreeSame[i*3+j]];
}
RemoveCard(FrontCard,3,btCardData,btCardCount);
btCardCount1=btCardCount-=3;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bFlush) //有同花
{
for(int j=0;j<tagCardType1.btFlush;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
BackCard[k]=btCardData1[tagCardType1.cbFlush[j*5+k]];
}
RemoveCard(BackCard,5,btCardData1,btCardCount1);
CopyMemory(MidCard,btCardData1,sizeof(MidCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(tagCardType1.bStraight) //有顺子
{
for(int j=0;j<tagCardType1.btStraight;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
BackCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(BackCard,5,btCardData1,btCardCount1);
CopyMemory(MidCard,btCardData1,sizeof(MidCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
BackCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(BackCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame)
{
for(int k=0;k<tagCardType2.btThreeSame;k++)
{
for(int m=0;m<3;m++)
{
MidCard[m]=btCardData2[tagCardType2.cbThreeSame[k*3+m]];
}
RemoveCard(MidCard,3,btCardData2,btCardCount2);
BackCard[3]=btCardData2[2];
BackCard[4]=btCardData2[3];
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
}
}
if(bThreeSame==false)
{
if(tagCardType.bFlush) //第三敦为同花
{
for(int i=0;i<tagCardType.btFlush;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<5;j++)
{
BackCard[j]=btCardData[tagCardType.cbFlush[i*5+j]];
}
RemoveCard(BackCard,5,btCardData,btCardCount);
btCardCount1=btCardCount-=5;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bFlush) //剩下同花
{
for(int j=0;j<tagCardType1.btFlush;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbFlush[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bStraight) //剩下顺子
{
for(int j=0;j<tagCardType1.btStraight;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bThreeSame) //剩下三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //三条
{
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(FrontCard,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<2)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
}
else //散牌
{
for(int k=0;k<5;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else //散牌
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k+1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
}
else //散牌
{
for(int k=0;k<6;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k-1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType.bStraight) //第三敦为顺子
{
for(int i=0;i<tagCardType.btStraight;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<5;j++)
{
BackCard[j]=btCardData[tagCardType.cbStraight[i*5+j]];
}
RemoveCard(BackCard,5,btCardData,btCardCount);
btCardCount1=btCardCount-=5;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bStraight) //剩下顺子
{
for(int j=0;j<tagCardType1.btStraight;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bThreeSame) //剩下三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //三条
{
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(FrontCard,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<2)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
}
else //散牌
{
for(int k=0;k<5;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else //散牌
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k+1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
}
else //散牌
{
for(int k=0;k<6;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k-1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType.bThreeSame) //第三敦为三条
{
for(int i=0;i<tagCardType.btThreeSame;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<3;j++)
{
BackCard[j]=btCardData[tagCardType.cbThreeSame[i*3+j]];
}
RemoveCard(BackCard,3,btCardData,btCardCount);
btCardCount1=btCardCount-=3;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bThreeSame) //剩下三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //三条
{
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(FrontCard,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[3]=btCardData2[2];
BackCard[4]=btCardData2[3];
}
else if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<2)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=BackCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
BackCard[3]=btCardData2[3];
BackCard[4]=btCardData2[4];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[3]=btCardData2[3];
MidCard[4]=btCardData2[4];
BackCard[3]=btCardData2[5];
BackCard[4]=btCardData2[6];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
BackCard[3]=btCardData1[2];
BackCard[4]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
BackCard[3]=btCardData2[0];
BackCard[4]=btCardData2[1];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[3]=btCardData2[2];
BackCard[4]=btCardData2[3];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[3]=btCardData2[4];
BackCard[4]=btCardData2[5];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[3]=btCardData2[4];
BackCard[4]=btCardData2[5];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[2]=btCardData2[3];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[5];
BackCard[3]=btCardData2[6];
BackCard[4]=btCardData2[7];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
BackCard[3]=btCardData1[8];
BackCard[4]=btCardData1[9];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType.bTwoPare) //第三敦为两对
{
if(tagCardType.btOnePare<4)
{
for(int i=0;i<tagCardType.btTwoPare;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<4;j++)
{
BackCard[j]=btCardData[tagCardType.cbTwoPare[i*4+j]];
}
RemoveCard(BackCard,4,btCardData,btCardCount);
btCardCount1=btCardCount-=4;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
BackCard[4]=btCardData1[2];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[4]=btCardData2[2];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[4]=btCardData2[4];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[4]=btCardData2[4];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[2]=btCardData2[3];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[5];
BackCard[4]=btCardData2[6];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
BackCard[4]=btCardData1[8];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else
{
if(tagCardType.btOnePare==4)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=BackCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=BackCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=BackCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[3]=BackCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[4]=MidCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[5]=MidCard[1]=btCardData[tagCardType.cbOnePare[3]];
btTemp[6]=MidCard[2]=btCardData[tagCardType.cbOnePare[4]];
btTemp[7]=MidCard[3]=btCardData[tagCardType.cbOnePare[5]];
RemoveCard(btTemp,8,btCardData,btCardCount);
FrontCard[0]=btCardData[0];
FrontCard[1]=btCardData[1];
FrontCard[2]=btCardData[2];
MidCard[4]=btCardData[3];
BackCard[4]=btCardData[4];
if(GetCardLogicValue(FrontCard[0])==14&&GetCardLogicValue(FrontCard[1])==13)
{
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
else
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=BackCard[0]=btCardData[tagCardType.cbOnePare[4]];
btTemp[1]=BackCard[1]=btCardData[tagCardType.cbOnePare[5]];
btTemp[2]=BackCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[3]=BackCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[4]=MidCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[5]=MidCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[6]=FrontCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[7]=FrontCard[1]=btCardData[tagCardType.cbOnePare[3]];
RemoveCard(btTemp,8,btCardData,btCardCount);
FrontCard[2]=btCardData[0];
MidCard[2]=btCardData[1];
MidCard[3]=btCardData[2];
MidCard[4]=btCardData[3];
BackCard[4]=btCardData[4];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType.btOnePare==5)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=FrontCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData[tagCardType.cbOnePare[4]];
btTemp[3]=MidCard[1]=btCardData[tagCardType.cbOnePare[5]];
btTemp[4]=MidCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[5]=MidCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[6]=BackCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[7]=BackCard[1]=btCardData[tagCardType.cbOnePare[3]];
btTemp[8]=BackCard[2]=btCardData[tagCardType.cbOnePare[8]];
btTemp[9]=BackCard[3]=btCardData[tagCardType.cbOnePare[9]];
RemoveCard(btTemp,10,btCardData,btCardCount);
FrontCard[2]=btCardData[0];
MidCard[4]=btCardData[1];
BackCard[4]=btCardData[2];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
if(tagCardType.bOnePare) //第三敦为一对
{
for(int i=0;i<tagCardType.btOnePare;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<2;j++)
{
BackCard[j]=btCardData[tagCardType.cbOnePare[i*2+j]];
}
RemoveCard(BackCard,2,btCardData,btCardCount);
btCardCount1=btCardCount-=2;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[2]=btCardData2[4];
BackCard[3]=btCardData2[5];
BackCard[4]=btCardData2[6];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[2]=btCardData2[3];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[5];
BackCard[2]=btCardData2[6];
BackCard[3]=btCardData2[7];
BackCard[4]=btCardData2[8];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
BackCard[2]=btCardData1[8];
BackCard[3]=btCardData1[9];
BackCard[4]=btCardData1[10];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
}
else if(tagCardType.bStraight)//有顺子
{
bool bThreeSame=false;
for(int i=0;i<tagCardType.btThreeSame;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<3;j++)
{
FrontCard[j]=btCardData[tagCardType.cbThreeSame[i*3+j]];
}
RemoveCard(FrontCard,3,btCardData,btCardCount);
btCardCount1=btCardCount-=3;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bStraight) //有顺子
{
for(int j=0;j<tagCardType1.btStraight;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
BackCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(BackCard,5,btCardData1,btCardCount1);
CopyMemory(MidCard,btCardData1,sizeof(MidCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
if(tagCardType1.bThreeSame) //有三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
BackCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(BackCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame)
{
for(int k=0;k<tagCardType2.btThreeSame;k++)
{
for(int m=0;m<3;m++)
{
MidCard[m]=btCardData2[tagCardType2.cbThreeSame[k*3+m]];
}
RemoveCard(MidCard,3,btCardData2,btCardCount2);
BackCard[3]=btCardData2[2];
BackCard[4]=btCardData2[3];
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
bThreeSame=true;
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
}
}
}
}
if(bThreeSame==false)
{
if(tagCardType.bStraight) //第三敦为顺子
{
for(int i=0;i<tagCardType.btStraight;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<5;j++)
{
BackCard[j]=btCardData[tagCardType.cbStraight[i*5+j]];
}
RemoveCard(BackCard,5,btCardData,btCardCount);
btCardCount1=btCardCount-=5;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bStraight) //剩下顺子
{
for(int j=0;j<tagCardType1.btStraight;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<5;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbStraight[j*5+k]];
}
RemoveCard(MidCard,5,btCardData1,btCardCount1);
CopyMemory(FrontCard,btCardData1,sizeof(FrontCard));
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bThreeSame) //剩下三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //三条
{
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(FrontCard,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<2)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
}
else //散牌
{
for(int k=0;k<5;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
}
else //散牌
{
for(int k=0;k<4;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k+1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
}
else //散牌
{
for(int k=0;k<6;k++)
{
if(k<3)
{
FrontCard[k]=btCardData2[k];
}
else
{
MidCard[k-1]=btCardData2[k];
}
}
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType.bThreeSame) //第三敦为三条
{
for(int i=0;i<tagCardType.btThreeSame;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<3;j++)
{
BackCard[j]=btCardData[tagCardType.cbThreeSame[i*3+j]];
}
RemoveCard(BackCard,3,btCardData,btCardCount);
btCardCount1=btCardCount-=3;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bThreeSame) //剩下三条
{
for(int j=0;j<tagCardType1.btThreeSame;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<3;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbThreeSame[j*3+k]];
}
RemoveCard(MidCard,3,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=3;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bThreeSame) //三条
{
for(int k=0;k<3;k++)
{
FrontCard[k]=btCardData2[tagCardType2.cbThreeSame[k]];
}
RemoveCard(FrontCard,3,btCardData2,btCardCount2);
MidCard[3]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[3]=btCardData2[2];
BackCard[4]=btCardData2[3];
}
else if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<2)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=BackCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[3]=btCardData2[1];
MidCard[4]=btCardData2[2];
BackCard[3]=btCardData2[3];
BackCard[4]=btCardData2[4];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[3]=btCardData2[3];
MidCard[4]=btCardData2[4];
BackCard[3]=btCardData2[5];
BackCard[4]=btCardData2[6];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
BackCard[3]=btCardData1[2];
BackCard[4]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
BackCard[3]=btCardData2[0];
BackCard[4]=btCardData2[1];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[3]=btCardData2[2];
BackCard[4]=btCardData2[3];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[3]=btCardData2[4];
BackCard[4]=btCardData2[5];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[3]=btCardData2[4];
BackCard[4]=btCardData2[5];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[2]=btCardData2[3];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[5];
BackCard[3]=btCardData2[6];
BackCard[4]=btCardData2[7];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
BackCard[3]=btCardData1[8];
BackCard[4]=btCardData1[9];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
if(tagCardType.bTwoPare) //第三敦为两对
{
if(tagCardType.btOnePare<4)
{
for(int i=0;i<tagCardType.btTwoPare;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<4;j++)
{
BackCard[j]=btCardData[tagCardType.cbTwoPare[i*4+j]];
}
RemoveCard(BackCard,4,btCardData,btCardCount);
btCardCount1=btCardCount-=4;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bTwoPare) //剩下两对
{
if(tagCardType1.btOnePare>=3)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
btTemp[0]=FrontCard[0]=btCardData1[tagCardType1.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData1[tagCardType1.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData1[tagCardType1.cbOnePare[2]];
btTemp[3]=MidCard[1]=btCardData1[tagCardType1.cbOnePare[3]];
btTemp[4]=MidCard[2]=btCardData1[tagCardType1.cbOnePare[4]];
btTemp[5]=MidCard[3]=btCardData1[tagCardType1.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData1,btCardCount1);
FrontCard[2]=btCardData1[0];
MidCard[4]=btCardData1[1];
BackCard[4]=btCardData1[2];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=ThreeDunAllShuiShu(FrontFrontCard,FrontMidCard,FrontBackCard);
bFirst=false;
}
}
else
{
btAllShuiShu=ThreeDunAllShuiShu(FrontCard,MidCard,BackCard);
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
btFrontAllShuiShu=btAllShuiShu;
}
}
}
else
{
for(int j=0;j<tagCardType1.btTwoPare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<4;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbTwoPare[j*4+k]];
}
RemoveCard(MidCard,4,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=4;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bTwoPare) //两对
{
for(int k=0;k<4;k++)
{
if(k<3)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbTwoPare[k]];
}
else
{
btTemp[k]=MidCard[k+1]=btCardData2[tagCardType2.cbTwoPare[k]];
}
}
RemoveCard(btTemp,4,btCardData2,btCardCount2);
BackCard[4]=btCardData2[0];
}
else if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[4]=btCardData2[1];
BackCard[4]=btCardData2[2];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[4]=btCardData2[4];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
else if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[4]=btCardData2[4];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[2]=btCardData2[3];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[5];
BackCard[4]=btCardData2[6];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
BackCard[4]=btCardData1[8];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else
{
if(tagCardType.btOnePare==4)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=BackCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=BackCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=BackCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[3]=BackCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[4]=MidCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[5]=MidCard[1]=btCardData[tagCardType.cbOnePare[3]];
btTemp[6]=MidCard[2]=btCardData[tagCardType.cbOnePare[4]];
btTemp[7]=MidCard[3]=btCardData[tagCardType.cbOnePare[5]];
RemoveCard(btTemp,8,btCardData,btCardCount);
FrontCard[0]=btCardData[0];
FrontCard[1]=btCardData[1];
FrontCard[2]=btCardData[2];
MidCard[4]=btCardData[3];
BackCard[4]=btCardData[4];
if(GetCardLogicValue(FrontCard[0])==14&&GetCardLogicValue(FrontCard[1])==13)
{
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
else
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=BackCard[0]=btCardData[tagCardType.cbOnePare[4]];
btTemp[1]=BackCard[1]=btCardData[tagCardType.cbOnePare[5]];
btTemp[2]=BackCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[3]=BackCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[4]=MidCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[5]=MidCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[6]=FrontCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[7]=FrontCard[1]=btCardData[tagCardType.cbOnePare[3]];
RemoveCard(btTemp,8,btCardData,btCardCount);
FrontCard[2]=btCardData[0];
MidCard[2]=btCardData[1];
MidCard[3]=btCardData[2];
MidCard[4]=btCardData[3];
BackCard[4]=btCardData[4];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, false))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, false) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType.btOnePare==5)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=FrontCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=FrontCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=MidCard[0]=btCardData[tagCardType.cbOnePare[4]];
btTemp[3]=MidCard[1]=btCardData[tagCardType.cbOnePare[5]];
btTemp[4]=MidCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[5]=MidCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[6]=BackCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[7]=BackCard[1]=btCardData[tagCardType.cbOnePare[3]];
btTemp[8]=BackCard[2]=btCardData[tagCardType.cbOnePare[8]];
btTemp[9]=BackCard[3]=btCardData[tagCardType.cbOnePare[9]];
RemoveCard(btTemp,10,btCardData,btCardCount);
FrontCard[2]=btCardData[0];
MidCard[4]=btCardData[1];
BackCard[4]=btCardData[2];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
if(tagCardType.bOnePare) //第三敦为一对
{
for(int i=0;i<tagCardType.btOnePare;i++)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int j=0;j<2;j++)
{
BackCard[j]=btCardData[tagCardType.cbOnePare[i*2+j]];
}
RemoveCard(BackCard,2,btCardData,btCardCount);
btCardCount1=btCardCount-=2;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
tagCardType1=GetType(btCardData1,btCardCount1);
if(tagCardType1.bOnePare) //剩下一对
{
for(int j=0;j<tagCardType1.btOnePare;j++)
{
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
for(int k=0;k<2;k++)
{
MidCard[k]=btCardData1[tagCardType1.cbOnePare[j*2+k]];
}
RemoveCard(MidCard,2,btCardData1,btCardCount1);
btCardCount2=btCardCount1-=2;
CopyMemory(btCardData2,btCardData1,sizeof(btCardData1[0])*btCardCount2);
tagCardType2=GetType(btCardData2,btCardCount2);
if(tagCardType2.bOnePare) //一对
{
for(int k=0;k<2;k++)
{
btTemp[k]=FrontCard[k]=btCardData2[tagCardType2.cbOnePare[k]];
}
RemoveCard(btTemp,2,btCardData2,btCardCount2);
FrontCard[2]=btCardData2[0];
MidCard[2]=btCardData2[1];
MidCard[3]=btCardData2[2];
MidCard[4]=btCardData2[3];
BackCard[2]=btCardData2[4];
BackCard[3]=btCardData2[5];
BackCard[4]=btCardData2[6];
}
else //散牌
{
FrontCard[0]=btCardData2[0];
FrontCard[1]=btCardData2[1];
FrontCard[2]=btCardData2[2];
MidCard[2]=btCardData2[3];
MidCard[3]=btCardData2[4];
MidCard[4]=btCardData2[5];
BackCard[2]=btCardData2[6];
BackCard[3]=btCardData2[7];
BackCard[4]=btCardData2[8];
}
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
//散牌
btCardCount1=btCardCount;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
MidCard[0]=btCardData1[0];
MidCard[1]=btCardData1[4];
MidCard[2]=btCardData1[5];
MidCard[3]=btCardData1[6];
MidCard[4]=btCardData1[7];
BackCard[2]=btCardData1[8];
BackCard[3]=btCardData1[9];
BackCard[4]=btCardData1[10];
FrontCard[0]=btCardData1[1];
FrontCard[1]=btCardData1[2];
FrontCard[2]=btCardData1[3];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
}
}
else if(tagCardType.bThreeSame)//有三条
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
for(int i=0;i<3;i++)
{
FrontBackCard[i]=btCardData[tagCardType.cbThreeSame[i]];
}
RemoveCard(FrontBackCard, 3, btCardData, btCardCount);
btCardCount1=btCardCount-=3;
CopyMemory(btCardData1,btCardData,sizeof(btCardData[0])*btCardCount1);
FrontFrontCard[0]=btCardData1[1];
FrontFrontCard[1]=btCardData1[2];
FrontFrontCard[2]=btCardData1[3];
FrontMidCard[0]=btCardData1[0];
FrontMidCard[1]=btCardData1[4];
FrontMidCard[2]=btCardData1[5];
FrontMidCard[3]=btCardData1[6];
FrontMidCard[4]=btCardData1[7];
FrontBackCard[3]=btCardData1[8];
FrontBackCard[4]=btCardData1[9];
}
else if(tagCardType.bTwoPare)//有两对
{
if(tagCardType.btOnePare==2)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=FrontBackCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=FrontBackCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=FrontMidCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[3]=FrontMidCard[1]=btCardData[tagCardType.cbOnePare[3]];
RemoveCard(btTemp,4,btCardData,btCardCount);
FrontFrontCard[0]=btCardData[0];
FrontFrontCard[1]=btCardData[1];
FrontFrontCard[2]=btCardData[2];
FrontMidCard[2]=btCardData[3];
FrontMidCard[3]=btCardData[4];
FrontMidCard[4]=btCardData[5];
FrontBackCard[2]=btCardData[6];
FrontBackCard[3]=btCardData[7];
FrontBackCard[4]=btCardData[8];
}
else if(tagCardType.btOnePare==3)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=FrontBackCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=FrontBackCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=FrontMidCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[3]=FrontMidCard[1]=btCardData[tagCardType.cbOnePare[3]];
btTemp[4]=FrontFrontCard[0]=btCardData[tagCardType.cbOnePare[4]];
btTemp[5]=FrontFrontCard[1]=btCardData[tagCardType.cbOnePare[5]];
RemoveCard(btTemp,6,btCardData,btCardCount);
FrontFrontCard[2]=btCardData[0];
FrontMidCard[2]=btCardData[1];
FrontMidCard[3]=btCardData[2];
FrontMidCard[4]=btCardData[3];
FrontBackCard[2]=btCardData[4];
FrontBackCard[3]=btCardData[5];
FrontBackCard[4]=btCardData[6];
}
else if(tagCardType.btOnePare==4)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=BackCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=BackCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=BackCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[3]=BackCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[4]=MidCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[5]=MidCard[1]=btCardData[tagCardType.cbOnePare[3]];
btTemp[6]=MidCard[2]=btCardData[tagCardType.cbOnePare[4]];
btTemp[7]=MidCard[3]=btCardData[tagCardType.cbOnePare[5]];
RemoveCard(btTemp,8,btCardData,btCardCount);
FrontCard[0]=btCardData[0];
FrontCard[1]=btCardData[1];
FrontCard[2]=btCardData[2];
MidCard[4]=btCardData[3];
BackCard[4]=btCardData[4];
if(GetCardLogicValue(FrontCard[0])==14&&GetCardLogicValue(FrontCard[1])==13)
{
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
else
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=BackCard[0]=btCardData[tagCardType.cbOnePare[4]];
btTemp[1]=BackCard[1]=btCardData[tagCardType.cbOnePare[5]];
btTemp[2]=BackCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[3]=BackCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[4]=MidCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[5]=MidCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[6]=FrontCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[7]=FrontCard[1]=btCardData[tagCardType.cbOnePare[3]];
RemoveCard(btTemp,8,btCardData,btCardCount);
FrontCard[2]=btCardData[0];
MidCard[2]=btCardData[1];
MidCard[3]=btCardData[2];
MidCard[4]=btCardData[3];
BackCard[4]=btCardData[4];
if(bFirst)
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
bFirst=false;
}
}
else
{
if (CompareCard(FrontCard, MidCard, 3, 5, m_bClassicRule) && CompareCard(MidCard, BackCard, 5, 5, m_bClassicRule) &&
IsBiggerThanFront(FrontFrontCard,FrontMidCard,FrontBackCard,FrontCard,MidCard,BackCard))
{
CopyMemory(FrontFrontCard,FrontCard,sizeof(FrontCard));
CopyMemory(FrontMidCard,MidCard,sizeof(MidCard));
CopyMemory(FrontBackCard,BackCard,sizeof(BackCard));
}
}
}
}
else if(tagCardType.btOnePare==5)
{
CopyMemory(btCardData,btHandCardData,sizeof(btCardData));
btCardCount=btHandCardCount;
btTemp[0]=FrontFrontCard[0]=btCardData[tagCardType.cbOnePare[0]];
btTemp[1]=FrontFrontCard[1]=btCardData[tagCardType.cbOnePare[1]];
btTemp[2]=FrontMidCard[0]=btCardData[tagCardType.cbOnePare[4]];
btTemp[3]=FrontMidCard[1]=btCardData[tagCardType.cbOnePare[5]];
btTemp[4]=FrontMidCard[2]=btCardData[tagCardType.cbOnePare[6]];
btTemp[5]=FrontMidCard[3]=btCardData[tagCardType.cbOnePare[7]];
btTemp[6]=FrontBackCard[0]=btCardData[tagCardType.cbOnePare[2]];
btTemp[7]=FrontBackCard[1]=btCardData[tagCardType.cbOnePare[3]];
btTemp[8]=FrontBackCard[2]=btCardData[tagCardType.cbOnePare[8]];
btTemp[9]=FrontBackCard[3]=btCardData[tagCardType.cbOnePare[9]];
RemoveCard(btTemp,10,btCardData,btCardCount);
FrontFrontCard[2]=btCardData[0];
FrontMidCard[4]=btCardData[1];
FrontBackCard[4]=btCardData[2];
}
}
SortCardList(FrontFrontCard,3);
SortCardList(FrontMidCard,5);
SortCardList(FrontBackCard,5);
CopyMemory(btFrontCard,FrontFrontCard,sizeof(FrontFrontCard));
CopyMemory(btMidCard,FrontMidCard,sizeof(FrontMidCard));
CopyMemory(btBackCard,FrontBackCard,sizeof(FrontBackCard));
}
BYTE CGameLogic::ThreeDunAllShuiShu(BYTE btFrontCard[], BYTE btMidCard[], BYTE btBackCard[])
{
return 0;
//BYTE AllShuiShu=0;
//tagAnalyseType tagCardType1;
//tagAnalyseType tagCardType2;
//tagAnalyseType tagCardType3;
//ZeroMemory(&tagCardType1,sizeof(tagCardType1));
//ZeroMemory(&tagCardType2,sizeof(tagCardType2));
//ZeroMemory(&tagCardType3,sizeof(tagCardType3));
//tagCardType1=GetType(btFrontCard,3);
//tagCardType2=GetType(btMidCard,5);
//tagCardType3=GetType(btBackCard,5);
//if(tagCardType1.bThreeSame)
//{
// AllShuiShu+=3;
//}
//else
//{
// AllShuiShu+=1;
//}
//if(tagCardType2.btFiveSame)
//{
// AllShuiShu+=20;
//}
//else if(tagCardType2.bStraightFlush)
//{
// AllShuiShu+=10;
//}
//else if(tagCardType2.bFourSame)
//{
// AllShuiShu+=8;
//}
//else if(tagCardType2.bGourd)
//{
// AllShuiShu+=2;
//}
//else
//{
// AllShuiShu+=1;
//}
// if (tagCardType3.btFiveSame)
// {
// AllShuiShu+=10;
// }
//if(tagCardType3.bStraightFlush)
//{
// AllShuiShu+=5;
//}
//else if(tagCardType3.bFourSame)
//{
// AllShuiShu+=4;
//}
//else
//{
// AllShuiShu+=1;
//}
//return AllShuiShu;
}
bool CGameLogic::IsBiggerThanFront(BYTE btFrontFrontCard[], BYTE btFrontMidCard[], BYTE btFrontBackCard[], BYTE btFrontCard[], BYTE btMidCard[], BYTE btBackCard[])
{
int btFrontShuiShu=ThreeDunAllShuiShu(btFrontFrontCard,btFrontMidCard,btFrontBackCard);
int btShuiShu=ThreeDunAllShuiShu(btFrontCard,btMidCard,btBackCard);
tagAnalyseType tagFrontFrontCardType;
tagAnalyseType tagFrontMidCardType;
tagAnalyseType tagFrontBackCardType;
tagAnalyseType tagFrontCardType;
tagAnalyseType tagMidCardType;
tagAnalyseType tagBackCardType;
ZeroMemory(&tagFrontFrontCardType,sizeof(tagFrontFrontCardType));
ZeroMemory(&tagFrontMidCardType,sizeof(tagFrontMidCardType));
ZeroMemory(&tagFrontBackCardType,sizeof(tagFrontBackCardType));
ZeroMemory(&tagFrontCardType,sizeof(tagFrontCardType));
ZeroMemory(&tagMidCardType,sizeof(tagMidCardType));
ZeroMemory(&tagBackCardType,sizeof(tagBackCardType));
tagFrontFrontCardType=GetType(btFrontFrontCard,3);
tagFrontMidCardType=GetType(btFrontMidCard,5);
tagFrontBackCardType=GetType(btFrontBackCard,5);
tagFrontCardType=GetType(btFrontCard,3);
tagMidCardType=GetType(btMidCard,5);
tagBackCardType=GetType(btBackCard,5);
int btFrontWin=0;
int btWin=0;
int btCompare=0;
int btFrontCanWin=0;
int btCanWin=0;
if(IsSameCardData(btFrontFrontCard,btFrontCard,3,3)==false)
{
if(!(tagFrontFrontCardType.bThreeSame&&tagFrontCardType.bThreeSame))
{
if (CompareCard(btFrontFrontCard, btFrontCard, 3, 3, m_bClassicRule))
{
btCompare++;
}
else
{
btCompare--;
}
}
}
if(IsSameCardData(btFrontMidCard,btMidCard,5,5)==false)
{
if(!(tagFrontMidCardType.bThreeSame&&tagMidCardType.bThreeSame))
{
if (CompareCard(btFrontMidCard, btMidCard, 5, 5, m_bClassicRule))
{
btCompare++;
}
else
{
btCompare--;
}
}
else
{
BYTE btSpecialCard[13];
ZeroMemory(btSpecialCard,sizeof(btSpecialCard));
if(GetCardType(btMidCard,5,btSpecialCard)>GetCardType(btFrontMidCard,5,btSpecialCard))
{
btCompare++;
}
else if(GetCardType(btMidCard,5,btSpecialCard)<GetCardType(btFrontMidCard,5,btSpecialCard))
{
btCompare--;
}
}
}
if(IsSameCardData(btFrontBackCard,btBackCard,5,5)==false)
{
if(!(tagFrontBackCardType.bThreeSame&&tagBackCardType.bThreeSame))
{
if (CompareCard(btFrontBackCard, btBackCard, 5, 5, m_bClassicRule))
{
btCompare++;
}
else
{
btCompare--;
}
}
else
{
BYTE btSpecialCard[13];
ZeroMemory(btSpecialCard,sizeof(btSpecialCard));
if(GetCardType(btBackCard,5,btSpecialCard)>GetCardType(btFrontBackCard,5,btSpecialCard))
{
btCompare++;
}
else if(GetCardType(btBackCard,5,btSpecialCard)<GetCardType(btFrontBackCard,5,btSpecialCard))
{
btCompare--;
}
}
}
//前面的牌
if(tagFrontFrontCardType.bThreeSame)
{
btFrontWin+=1;
btFrontCanWin+=3;
}
else if(tagFrontFrontCardType.bOnePare)
{
btFrontWin+=1;
btFrontCanWin+=1;
}
else
{
if(GetCardLogicValue(btFrontFrontCard[0])==14)
{
btFrontWin+=0;
btFrontCanWin+=0;
}
else
{
btFrontWin+=-1;
btFrontCanWin+=-1;
}
}
//第二敦
if(tagFrontMidCardType.bFiveSame)
{
btFrontWin+=1;
btFrontCanWin+=20;
}
if(tagFrontMidCardType.bStraightFlush)
{
btFrontWin+=1;
btFrontCanWin+=10;
}
else if(tagFrontMidCardType.bFourSame)
{
btFrontWin+=1;
btFrontCanWin+=8;
}
else if(tagFrontMidCardType.bGourd)
{
btFrontWin+=1;
btFrontCanWin+=5;
}
else if(tagFrontMidCardType.bFlush)
{
btFrontWin+=1;
btFrontCanWin+=4;
}
else if(tagFrontMidCardType.bStraight)
{
btFrontWin+=1;
btFrontCanWin+=3;
}
else if(tagFrontMidCardType.bThreeSame)
{
btFrontWin+=1;
btFrontCanWin+=2;
}
else if(tagFrontMidCardType.bTwoPare)
{
if(GetCardLogicValue(btFrontMidCard[tagFrontMidCardType.cbTwoPare[0]])<6)
{
btFrontWin+=0;
btFrontCanWin+=0;
}
else
{
btFrontWin+=1;
btFrontCanWin+=1;
}
}
else if(tagFrontMidCardType.bOnePare)
{
if(GetCardLogicValue(btFrontMidCard[tagFrontMidCardType.cbOnePare[0]])<12)
{
btFrontWin+=-1;
btFrontCanWin+=-1;
}
else
{
btFrontWin+=0;
btFrontCanWin+=0;
}
}
else
{
btFrontWin+=-1;
btFrontCanWin+=-2;
}
//第三敦
if (tagFrontBackCardType.bFiveSame)
{
btFrontWin+=1;
btFrontCanWin+=10;
}
if(tagFrontBackCardType.bStraightFlush)
{
btFrontWin+=1;
btFrontCanWin+=5;
}
else if(tagFrontBackCardType.bFourSame)
{
btFrontWin+=1;
btFrontCanWin+=4;
}
else if(tagFrontBackCardType.bGourd)
{
btFrontWin+=1;
btFrontCanWin+=3;
}
else if(tagFrontBackCardType.bFlush)
{
if(GetCardLogicValue(btFrontBackCard[tagFrontBackCardType.cbFlush[0]])<11)
{
btFrontWin+=0;
btFrontCanWin+=1;
}
else
{
btFrontWin+=1;
btFrontCanWin+=2;
}
}
else if(tagFrontBackCardType.bStraight)
{
if(GetCardLogicValue(btFrontBackCard[tagFrontBackCardType.cbStraight[0]])<11)
{
btFrontWin+=-1;
btFrontCanWin+=-1;
}
else
{
btFrontWin+=0;
btFrontCanWin+=0;
}
}
else
{
if(tagFrontBackCardType.bThreeSame)
{
btFrontCanWin+=-2;
}
else if(tagFrontBackCardType.bTwoPare)
{
btFrontCanWin+=-3;
}
else if(tagFrontBackCardType.bOnePare)
{
btFrontCanWin+=-4;
}
else
{
btFrontCanWin+=-5;
}
btFrontWin+=-1;
}
//现在的牌
if(tagFrontCardType.bThreeSame)
{
btWin+=1;
btCanWin+=3;
}
else if(tagFrontCardType.bOnePare)
{
btWin+=1;
btCanWin+=1;
}
else
{
if(GetCardLogicValue(btFrontCard[0])==14)
{
btWin+=0;
btCanWin+=0;
}
else
{
btWin+=-1;
btCanWin+=-1;
}
}
//第二敦
if(tagMidCardType.bFiveSame)
{
btWin+=1;
btCanWin+=20;
}
if(tagMidCardType.bStraightFlush)
{
btWin+=1;
btCanWin+=10;
}
else if(tagMidCardType.bFourSame)
{
btWin+=1;
btCanWin+=8;
}
else if(tagMidCardType.bGourd)
{
btWin+=1;
btCanWin+=5;
}
else if(tagMidCardType.bFlush)
{
btWin+=1;
btCanWin+=4;
}
else if(tagMidCardType.bStraight)
{
btWin+=1;
btCanWin+=3;
}
else if(tagMidCardType.bThreeSame)
{
btWin+=1;
btCanWin+=2;
}
else if(tagMidCardType.bTwoPare)
{
if(GetCardLogicValue(btMidCard[tagMidCardType.cbTwoPare[0]])<6)
{
btWin+=0;
btCanWin+=0;
}
else
{
btWin+=1;
btCanWin+=1;
}
}
else if(tagMidCardType.bOnePare)
{
if(GetCardLogicValue(btMidCard[tagMidCardType.cbOnePare[0]])<12)
{
btWin+=-1;
btCanWin+=-1;
}
else
{
btWin+=0;
btCanWin+=0;
}
}
else
{
btWin+=-1;
btCanWin+=-2;
}
//第三敦
if(tagBackCardType.bFiveSame)
{
btWin+=1;
btCanWin+=10;
}
if(tagBackCardType.bStraightFlush)
{
btWin+=1;
btCanWin+=5;
}
else if(tagBackCardType.bFourSame)
{
btWin+=1;
btCanWin+=4;
}
else if(tagBackCardType.bGourd)
{
btWin+=1;
btCanWin+=3;
}
else if(tagBackCardType.bFlush)
{
if(GetCardLogicValue(btBackCard[tagBackCardType.cbFlush[0]])<11)
{
btWin+=0;
btCanWin+=1;
}
else
{
btWin+=1;
btCanWin+=2;
}
}
else if(tagBackCardType.bStraight)
{
if(GetCardLogicValue(btBackCard[tagBackCardType.cbStraight[0]])<11)
{
btWin+=-1;
btCanWin+=-1;
}
else
{
btWin+=0;
btCanWin+=0;
}
}
else
{
if(tagBackCardType.bThreeSame)
{
btCanWin+=-2;
}
else if(tagBackCardType.bTwoPare)
{
btCanWin+=-3;
}
else if(tagBackCardType.bOnePare)
{
btCanWin+=-4;
}
else
{
btCanWin+=-5;
}
btWin+=-1;
}
if(btShuiShu==btFrontShuiShu)
{
if(btWin>btFrontWin)
{
return true;
}
else if(btWin==btFrontWin)
{
if(btCompare>=1)
{
return true;
}
else
{
if(btCanWin>btFrontCanWin)
{
return true;
}
else
{
return false;
}
}
}
else
{
return false;
}
}
else if(btShuiShu==btFrontShuiShu+1)
{
if(btFrontWin-btWin>=4)
{
return false;
}
else
{
return true;
}
}
else if(btShuiShu+1==btFrontShuiShu)
{
if(btWin-btFrontWin>=4)
{
return true;
}
else
{
return false;
}
}
else if(btShuiShu>btFrontShuiShu)
{
return true;
}
else if(btShuiShu<btFrontShuiShu)
{
return false;
}
return false;
}