예제 #1
0
//对比单牌
BOOL CUpGradeGameLogic::CompareOnlyOne(BYTE iFirstCard, BYTE iNextCard)
{
	int iFirstNum = GetCardNum(iFirstCard);//上手牌
	int iNextNum  = GetCardNum(iNextCard);//本家牌

	if (iFirstCard == 0x4F) return FALSE;//大王
	if (iNextCard == 0x4F) return TRUE;

	if (iFirstCard == 0x4E) return FALSE;//小王
	if (iNextCard == 0x4E) return TRUE;

	if (iFirstNum == 2) return FALSE;//2
	if (iNextNum == 2) return TRUE;

	return ((iNextNum - iFirstNum) > 0 ? TRUE : FALSE);//其他

	/*int iFristHua=GetCardHuaKind(iFirstCard,FALSE);
	int iNextHua=GetCardHuaKind(iNextCard,FALSE);
	if (iFristHua!=iNextHua)
	{
		//不同花色对比
		if (iFristHua==UG_NT_CARD) return TRUE;
		return (iNextHua!=UG_NT_CARD);
	}
	
	//同花色对比
	return GetCardBulk(iFirstCard,FALSE)>=GetCardBulk(iNextCard,FALSE);*/
}
예제 #2
0
//是否为葫芦(三张一样的牌带2张一样的牌)
BOOL CUpGradeGameLogic::IsHuLu(BYTE iCardList[], int iCardCount)
{
	if (iCardCount != 5) return FALSE;
	
	ReSortCard(iCardList,iCardCount);

	int pd0 = GetCardNum(iCardList[0]),
		pd1 = GetCardNum(iCardList[1]),
		pd2 = GetCardNum(iCardList[2]),
		pd3 = GetCardNum(iCardList[3]),
		pd4 = GetCardNum(iCardList[4]);

	return ((pd0 == pd1) && (pd1 == pd2) && (pd3 == pd4));
}
예제 #3
0
//是否为铁支(4张同样大小的牌)
BOOL CUpGradeGameLogic::IsTieZhi(BYTE iCardList[], int iCardCount)
{
	if (iCardCount < 4) 
		return FALSE;
	//int pd = -1;
	int temp[18]={0};
	for(int i=0;i<iCardCount;i++)
	{
		temp[GetCardNum(iCardList[i])]++;
	}

	for(int i=0;i<18;i++)
	{
		if(temp[i]==4)
			return  true;
	}
	return false;
	/*
	for (int i = 0;i < iCardCount;i++)
	{
		int dian = GetCardNum(iCardList[i]);
		if (pd < 0)
		{
			pd =dian;
			continue;
		}
		if (pd != dian) 
			return FALSE;
	}
	return TRUE;*/
}
예제 #4
0
// 对比单牌
BOOL CUpGradeGameLogic::CompareOnlyOne(BYTE iFirstCard, BYTE iNextCard)
{
	int iFirstNum = GetCardNum(iFirstCard);				// 上手牌
	int iNextNum  = GetCardNum(iNextCard);				// 本家牌

	if (iFirstCard == 0x4F) return FALSE;				// 大王
	if (iNextCard == 0x4F) return TRUE;

	if (iFirstCard == 0x4E) return FALSE;				// 小王
	if (iNextCard == 0x4E) return TRUE;

	if (iFirstNum == 2) return FALSE;					// 2
	if (iNextNum == 2) return TRUE;

	return ((iNextNum - iFirstNum) > 0 ? TRUE : FALSE);	// 其他
}
예제 #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
}
예제 #6
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;
}
예제 #7
0
// 获取扑克大小 (2 - 18 , 15 以上是主牌 : 2 - 21 , 15 以上是主)
int CUpGradeGameLogic::GetCardBulk(BYTE iCard, BOOL bExtVol)
{
	if ((iCard == 0x4E) || (iCard == 0x4F))
	{
		return bExtVol ? (iCard - 14) : (iCard - 62);	// 大小鬼64+14-62=16只返回大小猫的值
	}

	int iCardNum = GetCardNum(iCard);
	int iHuaKind = GetCardHuaKind(iCard);

	return ((bExtVol) ? ((iHuaKind >> 4) + (iCardNum * 4)) : (iCardNum));
}
예제 #8
0
//最小顺子(a,8,9,10,j)
BOOL CUpGradeGameLogic::IsSmallSingleContinue(BYTE iCardList[],int iCardCount)
{
	if(iCardCount<4)
		return FALSE;
	BYTE Temp[18]={0};
	for(int i = 0; i < iCardCount; i ++)
	{
		Temp[GetCardNum(iCardList[i])] ++;
	}
	
	if(Temp[14] && Temp[10]&&Temp[9]&&Temp[8]&&Temp[11])
		return TRUE;
	
	return FALSE;
}
예제 #9
0
//是否三条
BOOL CUpGradeGameLogic::IsThree(BYTE iCardList[], int iCardCount)
{
	if (iCardCount<3)
		return FALSE;
	int temp[17]={0},ithree=0;;
	for(int i=0;i<iCardCount;i++)
		temp[GetCardNum(iCardList[i])]++;

	for(int i=0;i<17;i++)
	{
		if(temp[i]==3)
			ithree++;
	}
	return (ithree==1);
}
예제 #10
0
//是否对牌
BOOL CUpGradeGameLogic::IsDouble(BYTE iCardList[], int iCardCount)
{
	if (iCardCount<2)
		return FALSE;
	int temp[17]={0},itwo=0;
	for(int i=0;i<iCardCount;i++)
		temp[GetCardNum(iCardList[i])]++;

	for(int i=0;i<17;i++)
	{
		if(temp[i]==2)
			itwo++;
	}
	return (itwo==1);
}
예제 #11
0
//在友牌数例中查找某张牌的数目
BYTE CUpGradeGameCard::FindACardNumInFriendList(BYTE iCardNum)
{
	int FriendCount=0;
	if(m_bFriendCardCount>0&&m_bCardCount>0)
	{
		for(int i=0;i<m_bFriendCardCount;i++)
		{
			if(GetCardNum(m_CardFriendArray.GetAt(i))==iCardNum)
				FriendCount++;
		}	
	}
	//	TCHAR sz[200];
	//	wsprintf(sz,"FriendCount=%d,m_bFriendCardCount=%d",FriendCount,m_bFriendCardCount);
	//	WriteStr(sz);
	return FriendCount;
}
예제 #12
0
// 是否为葫芦(三张一样的牌带2张一样的牌)
BOOL CUpGradeGameLogic::IsHuLu(BYTE iCardList[], int iCardCount)
{	
	ReSortCard(iCardList ,iCardCount);
	
	// 葫芦牌型重写 -----------xuqiangming--------begein
	if (iCardCount < 4)
		return FALSE;

	int temp[18] = {0};
	for(int i = 0; i < iCardCount; i++)
	{
		temp[GetCardNum(iCardList[i])]++;
	}	
	bool bThree = false;

	int iTemp = -1;

	for(int i = 0; i < 18; i++)
	{
		if( temp[i] == 3 )	// 先检查是否存在3个	
		{
			bThree = true;	
			iTemp = i;
		}
	}
	if (!bThree)			// 不存在3个的情况直接反回false
		return false;

	for(int i = 0; i < 18; i++)
	{
		if (i == iTemp)
		{
			continue;
		}
		if( temp[i] >= 2)	// 检查另外两个是否为对子
			return true;		
	}

	return false;
}
예제 #13
0
// 最小顺子(a,2,3,4,5)
BOOL CUpGradeGameLogic::IsSmallSingleContinue(BYTE iCardList[],int iCardCount)
{
	//for(int i=0;i<7;i++)
	//{
	//	if(iCardList[i]==0)
	//		return FALSE;
	//}
	if (IsSingleContinue(iCardList,iCardCount))
		return FALSE;
	if(iCardCount < 4)
		return FALSE;

	BYTE Temp[18] = {0};
	for(int i = 0; i < iCardCount; i ++)
	{
		Temp[GetCardNum(iCardList[i])] ++;
	}
	
	if(Temp[14] && Temp[1] && Temp[2] && Temp[3] && Temp[4])
		return TRUE;
	
	return FALSE;
}
예제 #14
0
// 是否为4条(4张同样大小的牌)
BOOL CUpGradeGameLogic::IsTieZhi(BYTE iCardList[], int iCardCount)
{
	/*for(int i=0;i<7;i++)
	{
		if(iCardList[i]==0)
			return FALSE;
	}*/
	if (iCardCount < 4) 
		return FALSE;
	//int pd = -1;
	int temp[18] = {0};
	for(int i = 0; i < iCardCount; i++)
	{
		temp[GetCardNum(iCardList[i])]++;
	}

	for(int i = 0;i < 18; i++)
	{
		if(temp[i] == 4)
			return  true;
	}
	return false;
}
예제 #15
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;
}
예제 #16
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;
}