Esempio n. 1
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));
}
Esempio n. 2
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;
}
Esempio n. 3
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;
}
Esempio n. 4
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;
}