Ejemplo n.º 1
0
// 是否同花(同花为五张牌为一种花式)
BOOL CUpGradeGameLogic::IsSameHua(BYTE iCardList[], int iCardCount)
{
	// 四个也可以算花
	if(iCardCount < 4)
		return FALSE;

	int hs = -1;
		SortCard(iCardList, NULL, iCardCount);
	int FourCardColor[4] = {0};
	// SevenCard[4][7]={0}; // 将牌分花色放入数组
	::memset(SevenCard, 0, sizeof(SevenCard));

	// ----------------同花重做------xuqiangming------Begin-------------
	for (int i = 0;i < iCardCount; i++)
	{
		int hua = GetCardHuaKind(iCardList[i]);
		FourCardColor[hua / 16]++;
		SevenCard[hua / 16][i] = iCardList[i];
	}
	
	// -------------------------修改判断是否为同花-----------------------
	for (int j = 0; j < 4; j++)
		if (FourCardColor[j] >= 5)
			return TRUE;
	return FALSE;
	// ----------------同花重做------xuqiangming------End------------
}
Ejemplo n.º 2
0
//重新排序
BOOL CUpGradeGameLogic::ReSortCard(BYTE iCardList[], int iCardCount)
{
	SortCard(iCardList,NULL,iCardCount);
	//====按牌形排大小
	int iStationVol[45];
	for (int i=0;i<iCardCount;i++)
	{
		iStationVol[i]=GetCardBulk(iCardList[i],false);
	}

	int Start=0;
	int j,step;
	BYTE CardTemp[8];					//用来保存要移位的牌形
	int CardTempVal[8];					//用来保存移位的牌面值
	for(int i=8;i>1;i--)				//在数组中找一个连续i张相同的值
	{
		for(j=Start;j<iCardCount;j++)
		{
			CardTemp[0]=iCardList[j];			//保存当前i个数组相同的值
			CardTempVal[0]=iStationVol[j];
				for(step=1;step<i&&j+step<iCardCount;)			//找一个连续i个值相等的数组(并保存于临时数组中)
				{
					if(iStationVol[j]==iStationVol[j+step])
					{
						CardTemp[step]=iCardList[j+step];			//用来保存牌形
						CardTempVal[step]=iStationVol[j+step];		//面值
						step++;
					}
					else
						break;
				}

			if(step>=i)			//找到一个连续i个相等的数组串起始位置为j,结束位置为j+setp-1
			{					//将从Start开始到j个数组后移setp个
				if(j!=Start)				//排除开始就是有序
				{
					for(;j>=Start;j--)					//从Start张至j张后移动i张
						{
							iCardList[j+i-1]=iCardList[j-1];
							iStationVol[j+i-1]=iStationVol[j-1];
						}
					for(int k=0;k<i;k++)				
					{
						iCardList[Start+k]=CardTemp[k];	//从Start开始设置成CardSave
						iStationVol[Start+k]=CardTempVal[k];
					}
				}
				Start=Start+i;
			}
			j=j+step-1;
		}
	}
	return true;
}
Ejemplo n.º 3
0
///获取底牌牌型
bool  CGameTaskLogic::GetBackCardType(BYTE bbackCardList[] , int  cbCardCount) 
{
	if(3 != cbCardCount)
	{
		return false ; 
	}

	BYTE iTempBackCard[3] ; 
	memset(iTempBackCard , 0 , sizeof(iTempBackCard)) ;
	memcpy(iTempBackCard , bbackCardList , sizeof(iTempBackCard)) ; 
  	
	SortCard(iTempBackCard , NULL ,cbCardCount) ; 

	if(iTempBackCard[0] == 0x4F && iTempBackCard[1] == 0x4E)
	{
		m_byBackCardType = TYPE_ROCKET ; 
	}
	else if(iTempBackCard[0] == 0x4F)
	{
		m_byBackCardType = TYPE_BIG_KING ; 
	}
	else if(iTempBackCard[0] == 0x4E)
	{
		m_byBackCardType = TYPE_SMALL_KING ; 
	}
	else
	{
		if(GetCardHuaKind(iTempBackCard[0] , true) == GetCardHuaKind(iTempBackCard[1] , true) && GetCardHuaKind(iTempBackCard[1] , true) == GetCardHuaKind(iTempBackCard[2] , true))
		{
			m_byBackCardType = TYPE_SAME_HUA ; 
		}
		else if(GetCardBulk(iTempBackCard[0]) == GetCardBulk(iTempBackCard[1]) &&  GetCardBulk(iTempBackCard[1]) == GetCardBulk(iTempBackCard[2]))
		{
			m_byBackCardType = TYPE_TRIPLE_CARD ; 
		}
		else if(GetCardBulk(iTempBackCard[0]) == GetCardBulk(iTempBackCard[1]) || GetCardBulk(iTempBackCard[1]) == GetCardBulk(iTempBackCard[2]))
		{
			m_byBackCardType = TYPE_DOUBLE_CARD; 
		}
		else if(true == IsBackCardStraight(iTempBackCard , cbCardCount))
		{
			m_byBackCardType = TYPE_STRAIT ; 
		}
		else
		{
			m_byBackCardType = TYPE_NONE ; 
		}
	}

	return (m_byBackCardType >0) ; 
}
Ejemplo n.º 4
0
//对比扑克,前者大于后者 TRUE,否则 FALSE
bool CGameLogic::CompareCard(BYTE bFirstList[], BYTE bLastList[], BYTE bCardCount)
{
	//排列扑克
	SortCard(bFirstList,bCardCount);
	SortCard(bLastList,bCardCount);
	
	//获取类型
	BYTE bFirstKind=GetCardKind(bFirstList,bCardCount);
	BYTE bLastKind=GetCardKind(bLastList,bCardCount);
	
	//类型不相同,对比类型
	if (bFirstKind!=bLastKind) return bFirstKind>bLastKind;
	
	//类型相同
	switch(bFirstKind)
	{
		//散牌
	case SHAN: return CompareSanCard(bFirstList,bLastList,bCardCount);
		//对子
	case DUI_ZI: return CompareDuiZhi(bFirstList,bLastList,bCardCount);
		//两对
	case LAING_DUI: return CompareLiangDui(bFirstList,bLastList,bCardCount);
		//三条
	case SAN_TIAO: return CompareSanTiao(bFirstList,bLastList);
		//顺子
	case SHUN_ZI: return CompareShunZhi(bFirstList,bLastList);
		//同花
	case TONG_HUA: return CompareTongHua(bFirstList,bLastList);
		//葫芦
	case HU_LU: return CompareHuLu(bFirstList,bLastList);
		//铁支
	case TIE_ZHI: return CompareTeiZhi(bFirstList,bLastList);
		//同花顺
	case TONG_HUA_SHUN: return CompareTongHuaShun(bFirstList,bLastList);
	}
	
	return false;
}
Ejemplo n.º 5
0
// 是否单顺,包括了最大顺子
BOOL CUpGradeGameLogic::IsSingleContinue(BYTE iCardList[], int iCardCount)
{
	SortCard(iCardList, NULL, iCardCount);

	// --------最小的同花顺-------
	BYTE Temp[18] = {0};
	for(int i = 0; i < iCardCount; i ++)
	{
		Temp[GetCardNum(iCardList[i])]++;
	}
	if(Temp[14] && Temp[5] && Temp[2] && Temp[3] && Temp[4])
	{
		return TRUE;
	}
	int kk;
	if (iCardCount == 5)
		kk = 1;
	else
		kk = 3;
	for(int k = 0; k < kk; k++)
	{
		int n = 0;
		int l = 1;
		for(int j = 1; j < iCardCount; j++)
		{			
			 if((GetCardNum(iCardList[k]) - GetCardNum(iCardList[j])) == l)
			 {
				l++;
				n++;
			 }
		}

		if(n >= 4)
			return TRUE;
		else
			continue;
	}

	// --------最小的同花顺-------   
		return FALSE;
	// 改写---end--yinyi
}
Ejemplo n.º 6
0
//是否同花(同花为五张牌为一种花式)
BOOL CUpGradeGameLogic::IsSameHua(BYTE iCardList[], int iCardCount)
{
	//if (iCardCount != 5) return FALSE;
	//四个也可以算花
	if(iCardCount<4)
		return FALSE;
	int hs = -1;
	SortCard(iCardList,NULL,iCardCount);
	for (int i = 0;i < iCardCount;i++)
	{
		int hua = GetCardHuaKind(iCardList[i]);
		if (hs < 0)
		{
			hs = hua;
			continue;
		}
		if (hs != hua) return FALSE;
	}
	return TRUE;
}
Ejemplo n.º 7
0
//是否单顺(至少5张)
BOOL CUpGradeGameLogic::IsSingleContinue(BYTE iCardList[], int iCardCount)
{
	//if (iCardCount != 5) return FALSE;
	if(iCardCount<4)
		return FALSE;
	
	//if (IsSameHua(iCardList,iCardCount)) return FALSE;

	SortCard(iCardList,NULL,iCardCount);
	
	int hs = -1;
	for (int i = 0;i < iCardCount - 1;i++)
	{
		//if (GetCardNum(iCardList[i]) == 2 || iCardList[i] == 0x4E || iCardList[i] == 0x4F)//不能含2和大小王
		//	return FALSE;
		if ((GetCardNum(iCardList[i]) % 15) != ((GetCardNum(iCardList[i+1]) + 1) % 15))
			return FALSE;
		
	}
	return TRUE;
}
Ejemplo n.º 8
0
//比较两手中牌的大小
int CUpGradeGameLogic::CompareCard(BYTE iFirstCard[], int iFirstCount, BYTE iSecondCard[], int iSecondCount)
{
	//return 1:iFirstCard > iSecondCard
	/***************************************************
	同花顺>铁支>葫芦>同花>顺子>三条>两对>对子>散牌
	***************************************************/
	BYTE iFirCard[5],iSecCard[5];

	::CopyMemory(iFirCard,iFirstCard,sizeof(BYTE)*iFirstCount);
	::CopyMemory(iSecCard,iSecondCard,sizeof(BYTE)*iSecondCount);


	BYTE iFirstCardKind = GetCardShape(iFirCard,iFirstCount),
		iSecondCardKind = GetCardShape(iSecCard,iSecondCount);

	ReSortCard(iFirCard,iFirstCount);
	ReSortCard(iSecCard,iSecondCount);

	//类型不同
	if (iFirstCardKind != iSecondCardKind) 
	{
		return (iFirstCardKind - iSecondCardKind > 0) ? 1 : -1;
	}

	//类型相同(先比较最大牌,后比较花色)
	switch (iFirstCardKind)
	{
	case SH_DOUBLE://对子
		{
			//对子大小
			int pd1 = GetCardNum(iFirCard[0]);
			int	pd2 = GetCardNum(iSecCard[0]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}
			int hs1,hs2;
			switch(iFirstCount)//当前对子相等,比较其他牌
			{
			case 2://仅为单对比较大小
				{
					hs1 = GetCardHuaKind(iFirCard[0]);
					hs2 = GetCardHuaKind(iSecCard[0]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			case 3://仅只有一单张
				{
					pd1 = GetCardNum(iFirCard[2]);
					pd2 = GetCardNum(iSecCard[2]);
					if (pd1 != pd2)
				 {
					 return (pd1 - pd2 > 0 ? 1 : -1);
				 }
					hs1 = GetCardHuaKind(iFirCard[2]);
					hs2 = GetCardHuaKind(iSecCard[2]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			case 4://二单张
				{
					pd1 = GetCardNum(iFirCard[2]);
					pd2 = GetCardNum(iSecCard[2]);
					if (pd1 != pd2)
				 {
					 return (pd1 - pd2 > 0 ? 1 : -1);
				 }

					pd1 = GetCardNum(iFirCard[3]);
					pd2 = GetCardNum(iSecCard[3]);
					if (pd1 != pd2)
				 {
					 return (pd1 - pd2 > 0 ? 1 : -1);
				 }
					hs1 = GetCardHuaKind(iFirCard[3]);
					hs2 = GetCardHuaKind(iSecCard[3]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			case 5://三单张
				{
					pd1 = GetCardNum(iFirCard[2]);
					pd2 = GetCardNum(iSecCard[2]);
					if (pd1 != pd2)
				 {
					 return (pd1 - pd2 > 0 ? 1 : -1);
				 }

					pd1 = GetCardNum(iFirCard[3]);
					pd2 = GetCardNum(iSecCard[3]);
					if (pd1 != pd2)
				 {
					 return (pd1 - pd2 > 0 ? 1 : -1);
				 }

					pd1 = GetCardNum(iFirCard[4]);
					pd2 = GetCardNum(iSecCard[4]);
					if (pd1 != pd2)
				 {
					 return (pd1 - pd2 > 0 ? 1 : -1);
				 }
					//比较最大单牌花色
					hs1 = GetCardHuaKind(iFirCard[2]);
					hs2 = GetCardHuaKind(iSecCard[2]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			}
		}
	case SH_SAME_HUA_CONTINUE://同花顺
	case SH_SMALL_SAME_HUA_CONTINUE://最小同花顺
	case SH_SAME_HUA://同花
	case SH_CONTINUE://顺子
		{
			int pd1 = GetCardNum(iFirCard[0]),
				pd2 = GetCardNum(iSecCard[0]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			int hs1 = GetCardHuaKind(iFirCard[0]),
				hs2 = GetCardHuaKind(iSecCard[0]);
			return (hs1 - hs2 > 0 ? 1 : -1);
		}

	case SH_TIE_ZHI://铁支
	case SH_HU_LU://葫芦
	case SH_THREE://三条
		{
			int pd1 = GetCardNum(iFirCard[0]),
				pd2 = GetCardNum(iSecCard[0]);

			return (pd1 - pd2 > 0 ? 1 : -1);

		}

	case SH_TWO_DOUBLE://对子先比较第一对,再比较第二对
		{
			//第一对比较
			int pd1 = GetCardNum(iFirCard[0]),
				pd2 = GetCardNum(iSecCard[0]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}
			//第二对比较
			pd1 = GetCardNum(iFirCard[2]);
			pd2 = GetCardNum(iSecCard[2]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}
			int hs1,hs2;

			switch(iFirstCount)
			{
			case 4://仅为二对,比较小对花色
				{
					hs1 = GetCardHuaKind(iFirCard[2]);
					hs2 = GetCardHuaKind(iSecCard[2]);	
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			case 5://仅一单张
				{
					pd1 = GetCardNum(iFirCard[4]);
					pd2 = GetCardNum(iSecCard[4]);
					if (pd1 != pd2)
				 {
					 return (pd1 - pd2 > 0 ? 1 : -1);
				 }
					hs1 = GetCardHuaKind(iFirCard[4]);
					hs2 = GetCardHuaKind(iSecCard[4]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			}
		}
	case SH_OTHER:	//单牌比较
		{
			SortCard(iFirCard,NULL,iFirstCount);
			SortCard(iSecCard,NULL,iSecondCount);

			int pd1 = GetCardNum(iFirCard[0]),
				pd2 = GetCardNum(iSecCard[0]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}
			int hs1,hs2;
			switch(iFirstCount)
			{
			case 1:
				{
					hs1 = GetCardHuaKind(iFirCard[0]);
					hs2 = GetCardHuaKind(iSecCard[0]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			case 2:
				{
					pd1 = GetCardNum(iFirCard[0]);
					pd2 = GetCardNum(iSecCard[0]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[1]);
					pd2 = GetCardNum(iSecCard[1]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					hs1 = GetCardHuaKind(iFirCard[1]);
					hs2 = GetCardHuaKind(iSecCard[1]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			case 3:
				{
					pd1 = GetCardNum(iFirCard[0]);
					pd2 = GetCardNum(iSecCard[0]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[1]);
					pd2 = GetCardNum(iSecCard[1]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[2]);
					pd2 = GetCardNum(iSecCard[2]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					hs1 = GetCardHuaKind(iFirCard[2]);
					hs2 = GetCardHuaKind(iSecCard[2]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			case 4:
				{
					pd1 = GetCardNum(iFirCard[0]);
					pd2 = GetCardNum(iSecCard[0]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[1]);
					pd2 = GetCardNum(iSecCard[1]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[2]);
					pd2 = GetCardNum(iSecCard[2]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[3]);
					pd2 = GetCardNum(iSecCard[3]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					hs1 = GetCardHuaKind(iFirCard[3]);
					hs2 = GetCardHuaKind(iSecCard[3]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}
			case 5:
				{
					pd1 = GetCardNum(iFirCard[0]);
					pd2 = GetCardNum(iSecCard[0]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[1]);
					pd2 = GetCardNum(iSecCard[1]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[2]);
					pd2 = GetCardNum(iSecCard[2]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[3]);
					pd2 = GetCardNum(iSecCard[3]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					pd1 = GetCardNum(iFirCard[4]);
					pd2 = GetCardNum(iSecCard[4]);
					if (pd1 != pd2)
					{
						return (pd1 - pd2 > 0 ? 1 : -1);
					}
					hs1 = GetCardHuaKind(iFirCard[0]);
					hs2 = GetCardHuaKind(iSecCard[0]);
					return (hs1 - hs2 > 0 ? 1 : -1);
				}	
			}
		}
	}
	return -1;
}
Ejemplo n.º 9
0
// 比较两手中牌的大小
int CUpGradeGameLogic::CompareCard(BYTE iFirstCard[], int iFirstCount, BYTE iSecondCard[], int iSecondCount)
{
	/***************************************************
	同花顺>4条>葫芦>同花>顺子>三条>两对>对子>散牌
	***************************************************/
	BYTE iFirCard[7], iSecCard[7];
	memset(iFirCard, 0, sizeof(iFirCard));
	memset(iSecCard, 0, sizeof(iSecCard));

	::CopyMemory(iFirCard, iFirstCard, sizeof(BYTE) * iFirstCount);
	::CopyMemory(iSecCard, iSecondCard, sizeof(BYTE) * iSecondCount);


	BYTE iFirstCardKind = GetCardShape(iFirCard, iFirstCount),
		iSecondCardKind = GetCardShape(iSecCard, iSecondCount);

	ReSortCard(iFirCard, iFirstCount);
	ReSortCard(iSecCard, iSecondCount);

	// 类型不同
	if (iFirstCardKind != iSecondCardKind) 
	{
		return (iFirstCardKind - iSecondCardKind > 0) ? 1 : -1;
	}

	// 类型相同(先比较最大牌,后比较花色)
	switch (iFirstCardKind)
	{
	case SH_DOUBLE: // 对子
		{
			// 比对子大小
			int pd1 = GetCardNum(iFirCard[0]);
			int	pd2 = GetCardNum(iSecCard[0]);

			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			// 比第3张牌
			pd1 = GetCardNum(iFirCard[2]);
			pd2 = GetCardNum(iSecCard[2]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			// 比第4张牌
			pd1 = GetCardNum(iFirCard[3]);
			pd2 = GetCardNum(iSecCard[3]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			// 比第5张牌
			pd1 = GetCardNum(iFirCard[4]);
			pd2 = GetCardNum(iSecCard[4]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			return 0;

			//int hs1,hs2;   
			//switch(iFirstCount) // 当前对子相等,比较其他牌
			//{
			////case 2: // 仅为单对比较大小  dxh注释
			////	{
			////		hs1 = GetCardHuaKind(iFirCard[0]);
			////		hs2 = GetCardHuaKind(iSecCard[0]);
			////		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			////		{
			////			return 0;
			////		}
			////		return (hs1 - hs2 > 0 ? 1 : -1);
			////	}
			////case 3: // 仅只有一单张
			////	{
			////		pd1 = GetCardNum(iFirCard[2]);
			////		pd2 = GetCardNum(iSecCard[2]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		hs1 = GetCardHuaKind(iFirCard[2]);
			////		hs2 = GetCardHuaKind(iSecCard[2]);
			////		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			////		{
			////			return 0;
			////		}
			////		return (hs1 - hs2 > 0 ? 1 : -1);
			////	}
			////case 4: // 二单张
			////	{
			////		pd1 = GetCardNum(iFirCard[2]);
			////		pd2 = GetCardNum(iSecCard[2]);
			////		if (pd1 != pd2)
			////	 {
			////		 return (pd1 - pd2 > 0 ? 1 : -1);
			////	 }

			////		pd1 = GetCardNum(iFirCard[3]);
			////		pd2 = GetCardNum(iSecCard[3]);
			////		if (pd1 != pd2)
			////	 {
			////		 return (pd1 - pd2 > 0 ? 1 : -1);
			////	 }
			////		hs1 = GetCardHuaKind(iFirCard[3]);
			////		hs2 = GetCardHuaKind(iSecCard[3]);
			////		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			////		{
			////			return 0;
			////		}
			////		return (hs1 - hs2 > 0 ? 1 : -1);
			////	}
			//case 5: // 三单张  //5
			//	{
			//		pd1 = GetCardNum(iFirCard[2]);
			//		pd2 = GetCardNum(iSecCard[2]);
			//		if (pd1 != pd2)
			//	 {
			//		 return (pd1 - pd2 > 0 ? 1 : -1);
			//	 }

			//		pd1 = GetCardNum(iFirCard[3]);
			//		pd2 = GetCardNum(iSecCard[3]);
			//		if (pd1 != pd2)
			//	 {
			//		 return (pd1 - pd2 > 0 ? 1 : -1);
			//	 }

			//		pd1 = GetCardNum(iFirCard[4]);
			//		pd2 = GetCardNum(iSecCard[4]);
			//		if (pd1 != pd2)
			//	 {
			//		 return (pd1 - pd2 > 0 ? 1 : -1);
			//	 }
			//		// 比较最大单牌花色
			//		hs1 = GetCardHuaKind(iFirCard[2]);
			//		hs2 = GetCardHuaKind(iSecCard[2]);
			//		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			//		{
			//			return 0;
			//		}
			//		return (hs1 - hs2 > 0 ? 1 : -1);
			//	}
			//}
		}
	case SH_REGIUS_SAME_HUA_CONTINUE:   // 皇家同花顺 
	case SH_SMALL_SAME_HUA_CONTINUE:    // 最小同花顺
	case SH_SAME_HUA_CONTINUE:       	// 同花顺
	{
		// 花色无大小
		/*int hs1=GetCardHuaKind(iFirCard[0]),
			hs2=GetCardHuaKind(iSecCard[0]);
		if ((!m_bCompareHuaSe) || (hs1 == hs2))
		{
			return 0;
		}
		return (hs1 - hs2 > 0 ? 1 : -1); */

		int pd1 = GetCardNum(iFirCard[0]),
			pd2 = GetCardNum(iSecCard[0]);
		if (pd1 != pd2)
		{
			return (pd1 - pd2 > 0 ? 1 : -1);
		}
		else 
		{
			return 0;
		}
	}
	
	case SH_SAME_HUA:			// 同花
		{
			//SortCard(iFirCard,NULL,iFirstCount);
			//SortCard(iSecCard,NULL,iSecondCount);

			// 比较每个牌大小
			int pd1 = GetCardNum(iFirCard[0]);
			int pd2 = GetCardNum(iSecCard[0]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}
			pd1 = GetCardNum(iFirCard[1]);
			pd2 = GetCardNum(iSecCard[1]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}
			pd1 = GetCardNum(iFirCard[2]);
			pd2 = GetCardNum(iSecCard[2]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}
			pd1 = GetCardNum(iFirCard[3]);
			pd2 = GetCardNum(iSecCard[3]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}
			pd1 = GetCardNum(iFirCard[4]);
			pd2 = GetCardNum(iSecCard[4]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			return 0;
			//hs1 = GetCardHuaKind(iFirCard[0]);
			//hs2 = GetCardHuaKind(iSecCard[0]);
			//if ((!m_bCompareHuaSe) || (hs1 == hs2))
			//{
			//	return 0;
			//}
			//return (hs1 - hs2 > 0 ? 1 : -1);
		}
	case SH_CONTINUE:			// 顺子
		{
			// 顺子只比最后一张牌最小的牌, 为什么不比第1张, 因为(AKQJ10与A2345在第一个牌中冲突了) duanxiaohui
			int pd1 = GetCardNum(iFirCard[4]),
				pd2 = GetCardNum(iSecCard[4]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			return 0;

			/*int hs1 = GetCardHuaKind(iFirCard[0]),
				hs2 = GetCardHuaKind(iSecCard[0]);
			if ((!m_bCompareHuaSe) || (hs1 == hs2))
			{
				return 0;
			}
			return (hs1 - hs2 > 0 ? 1 : -1);*/
		}

	case SH_TIE_ZHI:	// 4条
		{
			int pd1 = GetCardNum(iFirCard[0]),
				pd2 = GetCardNum(iSecCard[0]);

			// 比四条
			if(pd1!=pd2)
				return (pd1 - pd2 > 0 ? 1 : -1);

			// 比第5张牌
			pd1 = GetCardNum(iFirCard[4]);
			pd2 = GetCardNum(iSecCard[4]);
			if(pd1!=pd2)
				return (pd1 - pd2 > 0 ? 1 : -1);

			return 0;
		}
	case SH_HU_LU:		// 葫芦
		{
			int pd1 = GetCardNum(iFirCard[0]),
				pd2 = GetCardNum(iSecCard[0]);

			// 比三条
			if(pd1!=pd2)
				return (pd1 - pd2 > 0 ? 1 : -1);

			// 比对牌
			pd1 = GetCardNum(iFirCard[3]);
			pd2 = GetCardNum(iSecCard[3]);
			if(pd1!=pd2)
				return (pd1 - pd2 > 0 ? 1 : -1);

			return 0;
		}
		break;
	case SH_THREE:		// 三条
		{
			int pd1 = GetCardNum(iFirCard[0]),
				pd2 = GetCardNum(iSecCard[0]);

			// 比前面3张牌
			if(pd1!=pd2)
				return (pd1 - pd2 > 0 ? 1 : -1);

			// 比第4张牌
			pd1 = GetCardNum(iFirCard[3]);
			pd2 = GetCardNum(iSecCard[3]);
			if(pd1!=pd2)
				return (pd1 - pd2 > 0 ? 1 : -1);

			// 比第5张牌
			pd1 = GetCardNum(iFirCard[4]);
			pd2 = GetCardNum(iSecCard[4]);
			if(pd1!=pd2)
				return (pd1 - pd2 > 0 ? 1 : -1);


			return 0;
			//// 5张牌以内完全可以决定大小,不影响只比较5张的
			//pd1 = GetCardNum(iFirCard[5]);
			//pd2 = GetCardNum(iSecCard[5]);

			//if(pd1!=pd2)
			//	return (pd1 - pd2 > 0 ? 1 : -1);

			//pd1 = GetCardNum(iFirCard[6]);
			//pd2 = GetCardNum(iSecCard[6]);

			//if(pd1!=pd2)
			//	return (pd1 - pd2 > 0 ? 1 : -1);	// 以上判断牌面大小

			//if (!m_bCompareHuaSe)
			//{
			//	return 0;
			//}

			//    pd1 = GetCardHuaKind(iFirCard[3]);  // 以下判断牌的花色大小
			//	pd2 = GetCardHuaKind(iSecCard[3]);
			//if(pd1!=pd2)
			//   return (pd1 - pd2 > 0 ? 1 : -1);

			//     pd1 = GetCardHuaKind(iFirCard[4]);   
			//	 pd2 = GetCardHuaKind(iSecCard[4]);
			// if(pd1!=pd2)
			//   return (pd1 - pd2 > 0 ? 1 : -1);

			//    pd1 = GetCardHuaKind(iFirCard[5]);   
			//	pd2 = GetCardHuaKind(iSecCard[5]);
			//if(pd1!=pd2)
			//   return (pd1 - pd2 > 0 ? 1 : -1);
			//pd1 = GetCardHuaKind(iFirCard[6]);   
			//pd2 = GetCardHuaKind(iSecCard[6]);
			//if(pd1!=pd2)
			//	return (pd1 - pd2 > 0 ? 1 : -1);
			//return 0;
		}

	case SH_TWO_DOUBLE:	// 对子先比较第一对,再比较第二对
		{
			// 第一对比较
			int pd1 = GetCardNum(iFirCard[0]),
				pd2 = GetCardNum(iSecCard[0]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			// 第二对比较
			pd1 = GetCardNum(iFirCard[2]);
			pd2 = GetCardNum(iSecCard[2]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			// 比第5张牌
			pd1 = GetCardNum(iFirCard[4]);
			pd2 = GetCardNum(iSecCard[4]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			return 0;

			//int hs1,hs2;

			//switch(iFirstCount)
			//{
			////case 4:	// 仅为二对,比较小对花色 dxh注释
			////	{
			////		hs1 = GetCardHuaKind(iFirCard[2]);
			////		hs2 = GetCardHuaKind(iSecCard[2]);
			////		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			////		{
			////			return 0;
			////		}
			////		return (hs1 - hs2 > 0 ? 1 : -1);
			////	}

			//case 5:	// 仅一单张 //5
			//	{
			//		pd1 = GetCardNum(iFirCard[4]);
			//		pd2 = GetCardNum(iSecCard[4]);
			//		if (pd1 != pd2)
			//	 {
			//		 return (pd1 - pd2 > 0 ? 1 : -1);
			//	 }
			//		hs1 = GetCardHuaKind(iFirCard[4]);
			//		hs2 = GetCardHuaKind(iSecCard[4]);
			//		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			//		{
			//			return 0;
			//		}
			//		return (hs1 - hs2 > 0 ? 1 : -1);
			//	}
			//}
		}
	case SH_OTHER:	// 单牌比较
		{
			SortCard(iFirCard,NULL,iFirstCount);
			SortCard(iSecCard,NULL,iSecondCount);

			// 比第1张牌
			int pd1 = GetCardNum(iFirCard[0]),
				pd2 = GetCardNum(iSecCard[0]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			// 比第2张牌
			pd1 = GetCardNum(iFirCard[1]);
			pd2 = GetCardNum(iSecCard[1]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			// 比第3张牌
			pd1 = GetCardNum(iFirCard[2]);
			pd2 = GetCardNum(iSecCard[2]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			// 比第4张牌
			pd1 = GetCardNum(iFirCard[3]);
			pd2 = GetCardNum(iSecCard[3]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			// 比第5张牌
			pd1 = GetCardNum(iFirCard[4]);
			pd2 = GetCardNum(iSecCard[4]);
			if (pd1 != pd2)
			{
				return (pd1 - pd2 > 0 ? 1 : -1);
			}

			return 0;

			//int hs1,hs2;
			//switch(iFirstCount)
			//{
			////case 1:   dxh注释
			////	{
			////		hs1 = GetCardHuaKind(iFirCard[0]);
			////		hs2 = GetCardHuaKind(iSecCard[0]);
			////		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			////		{
			////			return 0;
			////		}
			////		return (hs1 - hs2 > 0 ? 1 : -1);
			////	}
			////case 2:
			////	{
			////		pd1 = GetCardNum(iFirCard[0]);
			////		pd2 = GetCardNum(iSecCard[0]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		pd1 = GetCardNum(iFirCard[1]);
			////		pd2 = GetCardNum(iSecCard[1]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		hs1 = GetCardHuaKind(iFirCard[1]);
			////		hs2 = GetCardHuaKind(iSecCard[1]);
			////		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			////		{
			////			return 0;
			////		}
			////		return (hs1 - hs2 > 0 ? 1 : -1);
			////	}
			////case 3:
			////	{
			////		pd1 = GetCardNum(iFirCard[0]);
			////		pd2 = GetCardNum(iSecCard[0]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		pd1 = GetCardNum(iFirCard[1]);
			////		pd2 = GetCardNum(iSecCard[1]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		pd1 = GetCardNum(iFirCard[2]);
			////		pd2 = GetCardNum(iSecCard[2]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		hs1 = GetCardHuaKind(iFirCard[2]);
			////		hs2 = GetCardHuaKind(iSecCard[2]);
			////		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			////		{
			////			return 0;
			////		}
			////		return (hs1 - hs2 > 0 ? 1 : -1);
			////	}
			////case 4:
			////	{
			////		pd1 = GetCardNum(iFirCard[0]);
			////		pd2 = GetCardNum(iSecCard[0]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		pd1 = GetCardNum(iFirCard[1]);
			////		pd2 = GetCardNum(iSecCard[1]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		pd1 = GetCardNum(iFirCard[2]);
			////		pd2 = GetCardNum(iSecCard[2]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		pd1 = GetCardNum(iFirCard[3]);
			////		pd2 = GetCardNum(iSecCard[3]);
			////		if (pd1 != pd2)
			////		{
			////			return (pd1 - pd2 > 0 ? 1 : -1);
			////		}
			////		hs1 = GetCardHuaKind(iFirCard[3]);
			////		hs2 = GetCardHuaKind(iSecCard[3]);
			////		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			////		{
			////			return 0;
			////		}
			////		return (hs1 - hs2 > 0 ? 1 : -1);
			////	}
			//case 5:
			//	{
			//		pd1 = GetCardNum(iFirCard[0]);
			//		pd2 = GetCardNum(iSecCard[0]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[1]);
			//		pd2 = GetCardNum(iSecCard[1]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[2]);
			//		pd2 = GetCardNum(iSecCard[2]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[3]);
			//		pd2 = GetCardNum(iSecCard[3]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[4]);
			//		pd2 = GetCardNum(iSecCard[4]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		hs1 = GetCardHuaKind(iFirCard[0]);
			//		hs2 = GetCardHuaKind(iSecCard[0]);
			//		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			//		{
			//			return 0;
			//		}
			//		return (hs1 - hs2 > 0 ? 1 : -1);
			//	}	
			//	/*case 7:
			//	{
			//		pd1 = GetCardNum(iFirCard[0]);
			//		pd2 = GetCardNum(iSecCard[0]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[1]);
			//		pd2 = GetCardNum(iSecCard[1]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[2]);
			//		pd2 = GetCardNum(iSecCard[2]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[3]);
			//		pd2 = GetCardNum(iSecCard[3]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[4]);
			//		pd2 = GetCardNum(iSecCard[4]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[5]);
			//		pd2 = GetCardNum(iSecCard[5]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		pd1 = GetCardNum(iFirCard[6]);
			//		pd2 = GetCardNum(iSecCard[6]);
			//		if (pd1 != pd2)
			//		{
			//			return (pd1 - pd2 > 0 ? 1 : -1);
			//		}
			//		hs1 = GetCardHuaKind(iFirCard[0]);
			//		hs2 = GetCardHuaKind(iSecCard[0]);
			//		if ((!m_bCompareHuaSe) || (hs1 == hs2))
			//		{
			//			return 0;
			//		}
			//		return (hs1 - hs2 > 0 ? 1 : -1);
			//	}	*/
			//}
		}
	}
	return -1;
}