package com.backfire.arithmetic;

import java.util.ArrayList;
import java.util.Collections;

import com.backfire.arithmetic.CardJudge.CardType;
import com.backfire.arithmetic.CardJudge3_Laizi.CardType_Laizi;

/**
 * 三人癞子斗地主自动判牌
 * 
 * @author Potter
 */
public class CardAuto3_Laizi {
	public ArrayList<Card> mOtherCard; // 对手出的牌
	public ArrayList<ArrayList<Card>> mReturnCardVec; // 比需要比较大的牌的数组

	public ArrayList<Card> mCardIsLaizi; // 分割后的癞子牌
	public ArrayList<Card> mCardWithNoLaizi; // 分割后的非癞子牌

	public CardAuto3_Laizi() {
		mOtherCard = new ArrayList<Card>();
		mReturnCardVec = new ArrayList<ArrayList<Card>>();
		mCardIsLaizi = new ArrayList<Card>();
		mCardWithNoLaizi = new ArrayList<Card>();
	}

	public void clear() {

	}

	public ArrayList<ArrayList<Card>> judgeCanBe(ArrayList<Card> myCardVec,
			ArrayList<Card> otherCard) {
		Collections.sort(myCardVec, new CardAssist.Desc());
		Collections.sort(mCardIsLaizi, new CardAssist.Desc());

		// ----------------------------优先加入王炸
		addKillBomb(myCardVec, mReturnCardVec);
		// ---------------------------------------//对手出牌的判断
		CardJudge3_Laizi cardJudegeLazi = new CardJudge3_Laizi();
		mOtherCard = otherCard;
		CardReturn_Laizi myReturnSecond = cardJudegeLazi
				.judgeCardType(otherCard);

		// ----------------------------------------------------分割牌型
		mCardWithNoLaizi.clear();
		mCardIsLaizi.clear();
		for (int i = 0; i < myCardVec.size(); ++i) {
			if (myCardVec.get(i).isLaiZi()) {
				mCardIsLaizi.add(myCardVec.get(i));
				continue;
			}
			mCardWithNoLaizi.add(myCardVec.get(i));
		}
		// ---------------------------------------次优先加入其他炸弹,判断所有的牌型与大小
		autoBOMB(mCardWithNoLaizi, myReturnSecond); // 测试通过
		// ----------------------------------------------------------------------
		if (myCardVec.size() < myReturnSecond.mCardNum)
			return mReturnCardVec;
		// 王炸，同色炸，三同，对

		// ----------------------------------------------------判断其他同类型牌大小
		switch (myReturnSecond.mCardType) {
		case SOLO:
			autoSOLO(myCardVec, myReturnSecond); // 测试通过
			break;
		case PAIR:
			autoPAIR(myCardVec, myReturnSecond); // 测试通过,待优化
			break;
		case TRIO:
			autoTRIO(myCardVec, myReturnSecond); // 测试通过
			break;
		case TRIO_X:
			if (otherCard.size() == 4)
				autoTRIO_WITH_1(myCardVec, myReturnSecond);// 通过测试
			else if (otherCard.size() == 5)
				autoTRIO_WITH_2(myCardVec, myReturnSecond);// 通过测试
			break;
		case CHAIN:
			autoCHAIN(myCardVec, myReturnSecond); // 测试通过
			break;
		case PAIR_CHAIN:
			autoPAIR_CHAIN(myCardVec, myReturnSecond);// 通过测试
			break;
		case PLANE:
			autoPLANE(myCardVec, myReturnSecond);// 通过测试
			break;
		case PLANE_1:
			autoPLANE_1(myCardVec, myReturnSecond);
			break;
		case PLANE_2:
			autoPLANE_2(myCardVec, myReturnSecond);
			break;
		case FOUR_WITH_X:
			if (otherCard.size() == 6) {
				autoFOUR_WITH_2(myCardVec, myReturnSecond);
			} else if (otherCard.size() == 8) {
				autoFOUR_WITH_4(myCardVec, myReturnSecond);
			}
			break;
		case CardEnd:
			// AutoSOLO(myCardVec , myReturnSecond);
			break;
		}

		Collections.reverse(mReturnCardVec);

		return mReturnCardVec;
	}

	public void addKillBomb(ArrayList<Card> myCardVec,
			ArrayList<ArrayList<Card>> mReturnCardVec) {
		if (myCardVec.size() >= 2) {
			if (myCardVec.get(0).getPoint() == Card.PointBigJoker
					&& myCardVec.get(1).getPoint() == Card.PointSmallJoker) {
				ArrayList<Card> myVec = new ArrayList<Card>();
				myVec.add(myCardVec.get(0));
				myVec.add(myCardVec.get(1));
				mReturnCardVec.add(myVec);
			}
		}
	}

	/***
	 * 删除掉重复元素
	 * 
	 * @param myCards
	 */
	public void deleteRepeat(ArrayList<Card> myCards) {
		if (null == myCards || myCards.isEmpty())
			return;
		Collections.sort(myCards, new CardAssist.Desc());
		for (int i = 0; i < myCards.size() - 1; i++) {
			if (myCards.get(i).isSamePoint(myCards.get(i + 1))) {
				myCards.remove(i);
			}
		}
	}

	public void autoSOLO(final ArrayList<Card> myCardVec,
			CardReturn_Laizi pCardReturn_LaiZi) {

		ArrayList<Card> mySurplusLaiziCopy = CardAssist.copyList(mCardIsLaizi);

		ArrayList<ArrayList<ArrayList<Card>>> allCardTypeList = CardAuto
				.splitAllCard(mCardWithNoLaizi);

		// 5.原癞子,筛选掉重复的
		deleteRepeat(mySurplusLaiziCopy);
		for (int i = 0; i < mySurplusLaiziCopy.size(); i++) {
			if (mySurplusLaiziCopy.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				ArrayList<Card> myVec = new ArrayList<Card>();
				myVec.add(mySurplusLaiziCopy.get(i));
				mReturnCardVec.add(myVec);
			}
		}
		// 4.原来3同
		if (allCardTypeList.size() > 1) {
			ArrayList<ArrayList<Card>> threeVec = allCardTypeList.get(1);// 从大到大
			Collections.reverse(threeVec);
			for (int i = 0; i < threeVec.size(); i++) {
				if (!threeVec.get(i).isEmpty()) {
					if (threeVec.get(i).get(0).getPoint() <= pCardReturn_LaiZi.mCardHead
							.getPoint()) {
						continue;
					}
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(threeVec.get(i).get(0));
					mReturnCardVec.add(myVec);
				}
			}
		}

		// 3.原对子
		if (allCardTypeList.size() > 0) {
			ArrayList<ArrayList<Card>> twoVec = allCardTypeList.get(0);
			Collections.reverse(twoVec);
			for (int i = 0; i < twoVec.size(); i++) {
				if (!twoVec.get(i).isEmpty()) {
					if (twoVec.get(i).get(0).getPoint() <= pCardReturn_LaiZi.mCardHead
							.getPoint()) {
						continue;
					}
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(twoVec.get(i).get(0));
					mReturnCardVec.add(myVec);
				}
			}
		}

		// 2.王炸
		if (allCardTypeList.size() > 3) {
			ArrayList<ArrayList<Card>> killBombVec = allCardTypeList.get(3);
			if (!killBombVec.isEmpty()) {
				ArrayList<Card> killBombList = killBombVec.get(0);
				Collections.sort(killBombList, new CardAssist.Desc());
				for (int i = 0; i < killBombList.size(); i++) {
					if (killBombList.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(killBombList.get(i));
						mReturnCardVec.add(myVec);
					}
				}
			}
		}

		// 1.原单张
		if (!mCardWithNoLaizi.isEmpty()) {
			Collections.sort(mCardWithNoLaizi, new CardAssist.Desc());
			for (int i = 0; i < mCardWithNoLaizi.size(); ++i) {
				if (mCardWithNoLaizi.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(mCardWithNoLaizi.get(i));
					mReturnCardVec.add(myVec);
				}
			}
		}
	}

	public void autoPAIR(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		if (pCard.size() < 2)// 牌张数不足时候推出
			return;

		int iPoint = Card.PointError;// 避免重复

		// ----------------------------------纯癞子组合
		for (int i = 0; i < mCardIsLaizi.size() - 1; ++i) {
			if (mCardIsLaizi.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				if (mCardIsLaizi.get(i).getPoint() == mCardIsLaizi.get(i + 1)
						.getPoint()) {
					if (iPoint == mCardIsLaizi.get(i).getPoint()) {
						continue;
					} else {
						iPoint = mCardIsLaizi.get(i).getPoint();
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(mCardIsLaizi.get(i));
						myVec.add(mCardIsLaizi.get(i + 1));
						mReturnCardVec.add(myVec);
					}
				}
			}
		}
		// -------------------------------------end
		iPoint = Card.PointError;// 避免重复
		// ----------------------------------------------单牌癞子组合
		do {
			if (mCardIsLaizi.isEmpty())
				break;

			for (int i = 0; i < mCardWithNoLaizi.size(); ++i) {
				if (mCardWithNoLaizi.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()
						&& mCardWithNoLaizi.get(i).getPoint() < Card.PointSmallJoker
						&& mCardIsLaizi.size() > 0) {
					if (iPoint == mCardWithNoLaizi.get(i).getPoint())
						continue;
					else {
						iPoint = mCardWithNoLaizi.get(i).getPoint();
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(mCardWithNoLaizi.get(i));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						mReturnCardVec.add(myVec);
					}
				}
			}
		} while (false);
		// ----------------------------end
		iPoint = Card.PointError;// 避免重复
		// --------------------------------------------非癞子

		ArrayList<Card> fourVec = new ArrayList<Card>();
		ArrayList<Card> threeVec = new ArrayList<Card>();
		ArrayList<Card> twoVec = new ArrayList<Card>();
		ArrayList<Card> oneVec = new ArrayList<Card>();

		explainVec(mCardWithNoLaizi, fourVec, threeVec, twoVec, oneVec);

		// ------拆4,优先级三----------
		for (int i = 0; i < fourVec.size(); i = i + 4) {
			if (i + 1 < fourVec.size()
					&& fourVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint()) {
				ArrayList<Card> myVec = new ArrayList<Card>();
				myVec.add(fourVec.get(i));
				myVec.add(fourVec.get(i + 1));
				mReturnCardVec.add(myVec);
			}
		}

		// ------拆3,优先级四----------
		for (int i = 0; i < threeVec.size(); i = i + 3) {
			if (i + 1 < threeVec.size()
					&& threeVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint()) {
				ArrayList<Card> myVec = new ArrayList<Card>();
				myVec.add(threeVec.get(i));
				myVec.add(threeVec.get(i + 1));
				mReturnCardVec.add(myVec);
			}
		}

		// -----原对子,优先最低----------
		if (twoVec.size() >= 2) {// 牌张数不足时候推出
			for (int i = 0; i < twoVec.size() - 1; ++i) {
				if (i + 1 < twoVec.size()
						&& twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
								.getPoint()) {
					if (twoVec.get(i).getPoint() == twoVec.get(i + 1)
							.getPoint()) {
						if (iPoint == twoVec.get(i).getPoint()) {
							continue;
						} else {
							iPoint = twoVec.get(i).getPoint();
						}

						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(twoVec.get(i));
						myVec.add(twoVec.get(i + 1));
						mReturnCardVec.add(myVec);
					}
				}
			}
		}

	}

	public void autoTRIO(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		ArrayList<Card> fourVec = new ArrayList<Card>();
		ArrayList<Card> threeVec = new ArrayList<Card>();
		ArrayList<Card> twoVec = new ArrayList<Card>();
		ArrayList<Card> oneVec = new ArrayList<Card>();

		explainVec(mCardWithNoLaizi, fourVec, threeVec, twoVec, oneVec);

		for (int i = 0; i < (int) fourVec.size() - 3; i = i + 4) // 如果存在4个的数据，优先级一
		{
			if (fourVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				ArrayList<Card> myVec = new ArrayList<Card>();
				myVec.add(fourVec.get(i));
				myVec.add(fourVec.get(i + 1));
				myVec.add(fourVec.get(i + 2));
				mReturnCardVec.add(myVec);
			}
		}

		if (mCardIsLaizi.size() >= 3) // 如果存在3张癞子牌, 优先级二，暂定只要最小的
		{
			if (mCardIsLaizi.get(0).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				ArrayList<Card> myVec = new ArrayList<Card>();
				int size = mCardIsLaizi.size();
				myVec.add(mCardIsLaizi.get(0));
				myVec.add(mCardIsLaizi.get(size - 1));
				myVec.add(mCardIsLaizi.get(size - 2));
				mReturnCardVec.add(myVec);
			}
		}

		if (mCardIsLaizi.size() >= 2) // 如果存在2张癞子牌, 优先级三，暂定只要最小的
		{
			for (int i = 0; i < oneVec.size(); ++i) {
				if (oneVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()
						&& oneVec.get(i).getPoint() < Card.PointSmallJoker) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					int size = mCardIsLaizi.size();
					myVec.add(oneVec.get(i));
					myVec.add(mCardIsLaizi.get(size - 1));
					myVec.add(mCardIsLaizi.get(size - 2));
					mReturnCardVec.add(myVec);
				}
			}
		}

		if (mCardIsLaizi.size() >= 1) // 如果存在1张癞子牌, 优先级四，暂定只要最小的
		{
			for (int i = 0; i < twoVec.size(); i = i + 2) {
				if (twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(twoVec.get(i));
					myVec.add(twoVec.get(i + 1));
					myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
					mReturnCardVec.add(myVec);
				}
			}
		}

		for (int i = 0; i < threeVec.size(); i = i + 3) {
			if (threeVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				ArrayList<Card> myVec = new ArrayList<Card>();
				myVec.add(threeVec.get(i));
				myVec.add(threeVec.get(i + 1));
				myVec.add(threeVec.get(i + 2));
				mReturnCardVec.add(myVec);
			}
		}
	}

	/**
	 * 找到所有合适的单张牌 对index=0，三同index=1，炸index=2，王炸index=3 顺序来补充牌型cardTypeList
	 * 
	 * @param allSplitList
	 * @param surplusCnt
	 * @param cardTypeList
	 */
	public boolean findSingleMatchCardType(
			ArrayList<ArrayList<ArrayList<Card>>> allSplitList, int head,
			ArrayList<Card> cardTypeList, int count) {
		if (allSplitList.isEmpty())
			return false;

		int endIndex = allSplitList.size();

		// 从小往大找
		for (int m = 0; m < endIndex; m++) {
			for (int z = 0; z < allSplitList.get(m).size(); z++) {
				ArrayList<Card> splitCards = allSplitList.get(m).get(z);// 牌序列从大到小
				for (int y = splitCards.size() - 1; y >= 0; y--) {
					if (y >= 0 && splitCards.get(y).getPoint() > head) {
						cardTypeList.add(splitCards.get(y));
						return true;
					}
				}
			}
		}
		return false;
	}

	/**
	 * 找所有合适的对子,对index=0，三同index=1，炸index=2，王炸index=3 顺序来补充牌型cardTypeList
	 * 
	 * @param allSplitList
	 * @param head头
	 * @param cardTypeList
	 * @return
	 */
	public boolean findPairMatchCardType(
			ArrayList<ArrayList<ArrayList<Card>>> allSplitList, int head,
			ArrayList<Card> cardTypeList) {
		if (allSplitList.isEmpty())
			return false;

		// 从小往大找
		for (int m = 0; m < allSplitList.size() - 1; m++) {
			for (int z = 0; z < allSplitList.get(m).size(); z++) {
				ArrayList<Card> splitCards = allSplitList.get(m).get(z);
				for (int y = 0; y < splitCards.size() && y < 2; y++) {
					if (splitCards.get(y).getPoint() > head) {
						cardTypeList.add(splitCards.get(y));
						return true;
					}
				}
			}
		}
		return false;
	}

	public boolean findPairMatchCardType_Laizi() {
		return false;
	}

	/**
	 * 对index=0，三同index=1，炸index=2，王炸index=3 顺序来补充牌型cardTypeList 填充合适的牌
	 * 
	 * @param allSplitList
	 * @param surplusCnt
	 * @param cardTypeList
	 */
	public boolean replenishCardType(
			ArrayList<ArrayList<ArrayList<Card>>> allSplitList, int surplusCnt,
			ArrayList<Card> cardTypeList, CardType cardType) {
		if (allSplitList.isEmpty())
			return false;

		int endIndex = 0;
		if (CardType.CardSingle == cardType) {
			endIndex = allSplitList.size();
		} else if (CardType.CardPair == cardType) {
			endIndex = allSplitList.size() - 1;// 排除王炸
		}

		for (int m = 0; m < endIndex; m++) {
			for (int z = 0; z < allSplitList.get(m).size(); z++) {
				ArrayList<Card> splitCards = allSplitList.get(m).get(z);
				int replenish = (splitCards.size() >= surplusCnt) ? surplusCnt
						: splitCards.size();
				surplusCnt = surplusCnt - replenish;
				for (int y = 0; y < replenish; y++) {
					cardTypeList.add(splitCards.get(y));
				}
				if (surplusCnt <= 0) {// 补完
					return true;
				}
			}
		}
		return false;
	}

	public void autoBOMB(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		if (pCardReturn_LaiZi.mCardType == CardType_Laizi.ROCKET)
			return; // 对面王炸，别比了。洗洗睡吧;

		if (pCardReturn_LaiZi.mCardType == CardType_Laizi.LAIZHI_BOMB) {
			judgeLAIZHI_BOMB(mCardIsLaizi,
					pCardReturn_LaiZi.mCardHead.getPoint());
		} else if (pCardReturn_LaiZi.mCardType == CardType_Laizi.BOMB) {
			judgeLAIZHI_BOMB(mCardIsLaizi, Card.Point0); // 癞子炸弹可以大过
			judgeBOMB(mCardWithNoLaizi, pCardReturn_LaiZi.mCardHead.getPoint());
		} else if (pCardReturn_LaiZi.mCardType == CardType_Laizi.MIX_BOMB) {
			judgeLAIZHI_BOMB(mCardIsLaizi, Card.Point0); // 癞子炸弹可以大过
			judgeBOMB(mCardWithNoLaizi, Card.Point0);
			judgeMIX_BOMB(mCardWithNoLaizi,
					pCardReturn_LaiZi.mCardHead.getPoint());
		} else // 其他牌型
		{
			judgeLAIZHI_BOMB(mCardIsLaizi, Card.Point0); // 癞子炸弹可以大过
			judgeBOMB(mCardWithNoLaizi, Card.Point0);
			judgeMIX_BOMB(mCardWithNoLaizi, Card.Point0);
		}

	}

	public void autoTRIO_WITH_1(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		// 不考虑4个癞子生成的三带一，4个癞子只允许生成癞子炸弹,不考虑可以变作炸弹，又变作该类型的情况
		ArrayList<Card> FourVec = new ArrayList<Card>();
		ArrayList<Card> ThreeVec = new ArrayList<Card>();
		ArrayList<Card> twoVec = new ArrayList<Card>();
		ArrayList<Card> OneVec = new ArrayList<Card>();
		explainVec(mCardWithNoLaizi, FourVec, ThreeVec, twoVec, OneVec);

		if ((mCardIsLaizi.size() >= 2) && (OneVec.size() >= 2)) // 不考虑组合单牌，去拆2,3,4对，因为有2,3,4对可以被拆的时候，就直接去组合2,3,4对的牌更好
		{
			for (int i = 0; i < OneVec.size(); ++i) {
				if (OneVec.get(i).getPoint() >= Card.PointSmallJoker)
					continue;

				if (OneVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(OneVec.get(i));
					myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
					myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 2));

					if (i != OneVec.size() - 1) {
						myVec.add(OneVec.get(OneVec.size() - 1));
					} else {
						myVec.add(OneVec.get(OneVec.size() - 2));
					}

					mReturnCardVec.add(myVec);
				}
			}
		}

		if ((mCardIsLaizi.size() >= 1) && (!twoVec.isEmpty())) // 不考虑2张癞子牌来变牌，如果有2张癞子，我可以和对子组成炸弹
		{
			for (int i = 0; i < twoVec.size(); i = i + 2) {
				if (twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(twoVec.get(i));
					myVec.add(twoVec.get(i + 1));
					myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));

					if (!OneVec.isEmpty()) {
						myVec.add(OneVec.get(OneVec.size() - 1));
						mReturnCardVec.add(myVec);
					} else {
						if ((i - 1) > 0) // 如果本对前面还有对，就拆一对
						{
							myVec.add(twoVec.get(i - 1));
							mReturnCardVec.add(myVec);
						} else if ((i + 2) < twoVec.size()) // 如果本对后面还有对，就拆一对
						{
							myVec.add(twoVec.get(i + 2));
							mReturnCardVec.add(myVec);
						}
					}
				}
			}
		}

		if (!ThreeVec.isEmpty()) {
			for (int i = 0; i < ThreeVec.size(); i = i + 3) {
				if (ThreeVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(ThreeVec.get(i));
					myVec.add(ThreeVec.get(i + 1));
					myVec.add(ThreeVec.get(i + 2));

					if (!OneVec.isEmpty()) {
						myVec.add(OneVec.get(OneVec.size() - 1));
						mReturnCardVec.add(myVec);
					} else if (!twoVec.isEmpty()) {
						myVec.add(twoVec.get(twoVec.size() - 1));
						mReturnCardVec.add(myVec);
					} else {
						if ((i - 1) > 0) // 如果本对前面还有三，就拆一三
						{
							myVec.add(ThreeVec.get(i - 1));
							mReturnCardVec.add(myVec);
						} else if ((i + 3) < twoVec.size()) // 如果本对后面还有三，就拆一三
						{
							myVec.add(ThreeVec.get(i + 3));
							mReturnCardVec.add(myVec);
						}
					}
				}
			}
		}
	}

	public void autoTRIO_WITH_2(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		ArrayList<Card> FourVec = new ArrayList<Card>();
		ArrayList<Card> threeVec = new ArrayList<Card>();
		ArrayList<Card> twoVec = new ArrayList<Card>();
		ArrayList<Card> oneVec = new ArrayList<Card>();
		explainVec(mCardWithNoLaizi, FourVec, threeVec, twoVec, oneVec);// 优先分牌
		int isLaiziSize = mCardIsLaizi.size();
		// ------------------5张全为癞子牌的情况
		if (isLaiziSize >= 5) {
			if (mCardIsLaizi.get(0).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				ArrayList<Card> myVec = new ArrayList<Card>();
				myVec.add(mCardIsLaizi.get(0));
				myVec.add(mCardIsLaizi.get(isLaiziSize - 4));
				myVec.add(mCardIsLaizi.get(isLaiziSize - 3));
				myVec.add(mCardIsLaizi.get(isLaiziSize - 2));
				myVec.add(mCardIsLaizi.get(isLaiziSize - 1));
				mReturnCardVec.add(myVec);
			}
		}
		// ----------------------

		// -------------------4张癞子牌的情况 1, 2
		if (isLaiziSize >= 4) {
			// 三个的还可以拆分下：有时间再补充。四个的炸就没必要了，都构成两个炸，还凑个屁啊！

			for (int i = 0; i < twoVec.size(); i = i + 2) {
				if (twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(twoVec.get(i));// 牌型大小依赖普通牌，就算癞子最大也如此
					myVec.add(mCardIsLaizi.get(isLaiziSize - 4));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 3));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 2));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 1));
					mReturnCardVec.add(myVec);
				}
			}

			for (int i = 0; i < oneVec.size(); ++i) {
				if (oneVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(oneVec.get(i));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 4));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 3));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 2));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 1));
					mReturnCardVec.add(myVec);
				}
			}
		}
		// --------------------------

		// --------------------3张癞子牌的情况 1+1 , 2
		if (isLaiziSize >= 3) {
			if (oneVec.size() >= 2) {
				for (int i = 0; i < ((int) oneVec.size() - 1); ++i) {
					if (oneVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(oneVec.get(i));
						myVec.add(oneVec.get(i + 1));
						myVec.add(mCardIsLaizi.get(isLaiziSize - 3));
						myVec.add(mCardIsLaizi.get(isLaiziSize - 2));
						myVec.add(mCardIsLaizi.get(isLaiziSize - 1));
						mReturnCardVec.add(myVec);
					}
				}
			}

			for (int i = 0; i < twoVec.size(); i = i + 2) {
				if (twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(twoVec.get(i));
					myVec.add(twoVec.get(i + 1));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 3));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 2));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 1));
					mReturnCardVec.add(myVec);
				}
			}
		}
		// ------------------------------

		// ----------------------2张癞子牌的情况 1+2 ,3
		if (isLaiziSize >= 2) {
			if (!oneVec.isEmpty()) {
				for (int i = 0; i < twoVec.size(); i = i + 2) {
					if ((twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint())
							|| (oneVec.get(0).getPoint() > pCardReturn_LaiZi.mCardHead
									.getPoint())) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(twoVec.get(i));
						myVec.add(twoVec.get(i + 1));
						myVec.add(oneVec.get(0));
						myVec.add(mCardIsLaizi.get(isLaiziSize - 2));
						myVec.add(mCardIsLaizi.get(isLaiziSize - 1));
						mReturnCardVec.add(myVec);
					}
				}
			}

			for (int i = 0; i < threeVec.size(); i = i + 3) {
				if (threeVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(threeVec.get(i));
					myVec.add(threeVec.get(i + 1));
					myVec.add(threeVec.get(i + 2));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 2));
					myVec.add(mCardIsLaizi.get(isLaiziSize - 1));
					mReturnCardVec.add(myVec);
				}
			}
		}
		// --------------------------------

		// ----------------------1张癞子牌的情况3+1 , 2+2,
		if (isLaiziSize >= 1) {
			if (!threeVec.isEmpty()) {
				if (!oneVec.isEmpty()) {
					for (int i = 0; i < threeVec.size(); i = i + 3) {
						if (threeVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
								.getPoint() && i + 2 < threeVec.size()) {
							ArrayList<Card> myVec = new ArrayList<Card>();
							myVec.add(threeVec.get(i));
							myVec.add(threeVec.get(i + 1));
							myVec.add(threeVec.get(i + 2));
							myVec.add(oneVec.get(oneVec.size() - 1));
							myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
							mReturnCardVec.add(myVec);
						}
					}
				} else if (!twoVec.isEmpty() && twoVec.size() >= 2)// 拆分一个2对
				{
					for (int i = 0; i < threeVec.size(); i = i + 3) {
						if (threeVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
								.getPoint() && i + 2 < threeVec.size()) {
							ArrayList<Card> myVec = new ArrayList<Card>();
							myVec.add(threeVec.get(i));
							myVec.add(threeVec.get(i + 1));
							myVec.add(threeVec.get(i + 2));
							myVec.add(twoVec.get(twoVec.size() - 1));
							myVec.add(twoVec.get(twoVec.size() - 2));
							mReturnCardVec.add(myVec);
						}
					}
				}
			}

			if (twoVec.size() >= 4) {
				for (int i = 0; i < twoVec.size() - 4; i = i + 2) {
					if (twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint() && i + 3 < twoVec.size()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(twoVec.get(i));
						myVec.add(twoVec.get(i + 1));
						myVec.add(twoVec.get(twoVec.size() - 1));
						myVec.add(twoVec.get(twoVec.size() - 2));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						mReturnCardVec.add(myVec);
					}
				}
			}

		}
		// ---------------------------------

		// -----------------------没有癞子牌的情况
		if (mCardWithNoLaizi.size() >= 5) {
			CardAuto3 myAuto = new CardAuto3();
			ArrayList<ArrayList<Card>> myReturn = myAuto.judgeCanBe(
					mCardWithNoLaizi, mOtherCard, false);
			Collections.reverse(myReturn);
			for (int i = 0; i < myReturn.size(); ++i) {
				mReturnCardVec.add(myReturn.get(i));
			}
		}
		// ---------------------------------
	}

	public void autoFOUR_WITH_2(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		ArrayList<Card> fourVec = new ArrayList<Card>();
		ArrayList<Card> threeVec = new ArrayList<Card>();
		ArrayList<Card> twoVec = new ArrayList<Card>();
		ArrayList<Card> oneVec = new ArrayList<Card>();
		explainVec(mCardWithNoLaizi, fourVec, threeVec, twoVec, oneVec);

		if (mCardIsLaizi.size() >= 6) // 全为癞子
		{
			// 多余6个癞子的时候，可以完善
			if (mCardIsLaizi.get(0).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				ArrayList<Card> myVec = new ArrayList<Card>();
				myVec.add(mCardIsLaizi.get(0));
				myVec.add(mCardIsLaizi.get(1));
				myVec.add(mCardIsLaizi.get(2));
				myVec.add(mCardIsLaizi.get(3));
				myVec.add(mCardIsLaizi.get(4));
				myVec.add(mCardIsLaizi.get(5));
				mReturnCardVec.add(myVec);
			}
		}

		if (mCardIsLaizi.size() >= 5) {// 5癞子，只需1张
			if (!twoVec.isEmpty()) {
				for (int i = 0; i < twoVec.size(); i = i + 2) {
					if ((twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint())
							|| (mCardIsLaizi.get(0).getPoint() > pCardReturn_LaiZi.mCardHead
									.getPoint())) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(twoVec.get(i));
						myVec.add(mCardIsLaizi.get(0));
						myVec.add(mCardIsLaizi.get(1));
						myVec.add(mCardIsLaizi.get(2));
						myVec.add(mCardIsLaizi.get(3));
						myVec.add(mCardIsLaizi.get(4));
						mReturnCardVec.add(myVec);
					} else {
						break;
					}
				}
			}

			if (!oneVec.isEmpty()) {
				for (int i = 0; i < oneVec.size(); ++i) {
					if ((oneVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint())
							|| (mCardIsLaizi.get(0).getPoint() > pCardReturn_LaiZi.mCardHead
									.getPoint())) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(oneVec.get(i));
						myVec.add(mCardIsLaizi.get(0));
						myVec.add(mCardIsLaizi.get(1));
						myVec.add(mCardIsLaizi.get(2));
						myVec.add(mCardIsLaizi.get(3));
						myVec.add(mCardIsLaizi.get(4));
						mReturnCardVec.add(myVec);
					} else {
						break;
					}
				}
			}
		}

		if (mCardIsLaizi.size() >= 4) // 4癞子，2个单牌
		{
			if (oneVec.size() >= 2) {
				for (int i = 0; i < (int) oneVec.size() - 1; ++i) {
					if (oneVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(oneVec.get(i));
						myVec.add(oneVec.get(i + 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 2));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 3));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 4));
						mReturnCardVec.add(myVec);
					} else {
						break;
					}
				}
			}

			if (twoVec.size() >= 2) {
				for (int i = 0; i < twoVec.size(); i = i + 2) {
					if ((twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint())
							|| (twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
									.getPoint())) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(twoVec.get(i));
						myVec.add(twoVec.get(i + 1));
						myVec.add(mCardIsLaizi.get(0));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 2));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 3));
						mReturnCardVec.add(myVec);
					} else {
						break;
					}
				}
			}
		}

		if (mCardIsLaizi.size() >= 3) // 3癞子＋3个单牌
		{
			if (threeVec.size() >= 3) // 3个配
			{
				for (int i = 0; i < threeVec.size(); i = i + 3) {
					if (i + 2 < threeVec.size()
							&& threeVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
									.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(threeVec.get(i));
						myVec.add(threeVec.get(i + 1));
						myVec.add(threeVec.get(i + 2));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 2));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 3));
						mReturnCardVec.add(myVec);
					} else {
						break;
					}
				}
			}

			if (!oneVec.isEmpty() && !twoVec.isEmpty()) // 1 + 2
			{
				for (int i = 0; i < oneVec.size(); ++i) {
					if (twoVec.size() >= 2
							&& oneVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
									.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(oneVec.get(i));
						myVec.add(twoVec.get(twoVec.size() - 1));
						myVec.add(twoVec.get(twoVec.size() - 2));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 2));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 3));
						mReturnCardVec.add(myVec);
					} else {
						break;
					}
				}

				for (int i = 0; i < twoVec.size(); i = i + 2) {
					if (twoVec.size() >= 2
							&& twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
									.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(oneVec.get(oneVec.size() - 1));
						myVec.add(twoVec.get(i));
						myVec.add(twoVec.get(i + 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 2));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 3));
						mReturnCardVec.add(myVec);
					} else {
						break;
					}
				}
			}
		}

		if (mCardIsLaizi.size() >= 2) // 2癞子＋4
		{
			if (twoVec.size() >= 4) // 2+2
			{
				for (int i = 0; i < twoVec.size() - 2; i = i + 2) {
					if (twoVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(twoVec.get(i));
						myVec.add(twoVec.get(i + 1));
						myVec.add(twoVec.get(i + 2));
						myVec.add(twoVec.get(i + 3));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 2));
						mReturnCardVec.add(myVec);
					}
				}
			}

			if (threeVec.isEmpty() && !oneVec.isEmpty()) // 3+1
			{
				for (int i = 0; i < (int) threeVec.size(); i = i + 3) {
					if (threeVec.size() >= 3
							&& threeVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
									.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(threeVec.get(i));
						myVec.add(threeVec.get(i + 1));
						myVec.add(threeVec.get(i + 2));
						myVec.add(oneVec.get(oneVec.size() - 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 2));
						mReturnCardVec.add(myVec);
					}
				}
			}
		}

		if (mCardIsLaizi.size() >= 1) // 1癞子＋5
		{
			ArrayList<Card> myCardForOne = new ArrayList<Card>();

			if (fourVec.size() >= 4) // 4+1 ( 4+2 ) ( 4+3 )
			{
				if (!oneVec.isEmpty()) {
					myCardForOne.add(oneVec.get(oneVec.size() - 1));
				} else if (!twoVec.isEmpty()) {
					myCardForOne.add(twoVec.get(twoVec.size() - 1));
				} else if (!threeVec.isEmpty()) {
					myCardForOne.add(threeVec.get(threeVec.size() - 1));
				}

				for (int i = 0; i < fourVec.size(); i = i + 4) {
					if (myCardForOne.isEmpty()) {
						break;
					}

					if (fourVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
							.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(fourVec.get(i));
						myVec.add(fourVec.get(i + 1));
						myVec.add(fourVec.get(i + 2));
						myVec.add(fourVec.get(i + 3));
						myVec.add(myCardForOne.get(0));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						mReturnCardVec.add(myVec);
					}
				}
			}

			if ((!threeVec.isEmpty()) && (!twoVec.isEmpty())) {//
				for (int i = 0; i < threeVec.size(); i = i + 3) {
					if (i + 2 < threeVec.size()
							&& twoVec.size() >= 2
							&& threeVec.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
									.getPoint()) {
						ArrayList<Card> myVec = new ArrayList<Card>();
						myVec.add(threeVec.get(i));
						myVec.add(threeVec.get(i + 1));
						myVec.add(threeVec.get(i + 2));
						myVec.add(twoVec.get(twoVec.size() - 1));
						myVec.add(twoVec.get(twoVec.size() - 2));
						myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1));
						mReturnCardVec.add(myVec);
					}
				}
			}
		}

		// -----------------------没有癞子牌的情况
		if (mCardWithNoLaizi.size() >= 5) {
			CardAuto3 myAuto = new CardAuto3();
			ArrayList<ArrayList<Card>> myReturn = myAuto.judgeCanBe(
					mCardWithNoLaizi, mOtherCard, false);
			Collections.reverse(myReturn);
			for (int i = 0; i < myReturn.size(); ++i) {
				mReturnCardVec.add(myReturn.get(i));
			}
		}
	}

	public void autoFOUR_WITH_4(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		// 当前已经包含所有4个的组合
		ArrayList<ArrayList<Card>> myRetrunCard = new ArrayList<ArrayList<Card>>();
		if (!mReturnCardVec.isEmpty()) {
			for (int i = 0; i < mReturnCardVec.size(); i++) {
				myRetrunCard.add(CardAssist.copyList(mReturnCardVec.get(i)));
			}
		}
		mReturnCardVec.clear();

		ArrayList<ArrayList<Card>> returnCardVecForSawp = new ArrayList<ArrayList<Card>>();// 作为一个临时储存变量
		if (!myRetrunCard.isEmpty()) {
			addKillBomb(pCard, mReturnCardVec);
			for (int i = 0; i < myRetrunCard.size(); ++i) {
				ArrayList<Card> pCardCopy = CardAssist.copyList(pCard);
				CardAuto.myEarseVec(pCardCopy, myRetrunCard.get(i));

				ArrayList<Card> myRA_1 = myAddPair(pCardCopy);
				CardAuto.myEarseVec(pCardCopy, myRA_1);

				ArrayList<Card> myRA_2 = myAddPair(pCardCopy);
				if (myRetrunCard.get(i).size() < 4 || (myRA_1.size() < 2)
						|| (myRA_2.size() < 2))
					continue;

				myRA_1.add(myRA_2.get(0));
				myRA_1.add(myRA_2.get(1));
				myRA_1.add(myRetrunCard.get(i).get(0));
				myRA_1.add(myRetrunCard.get(i).get(1));
				myRA_1.add(myRetrunCard.get(i).get(2));
				myRA_1.add(myRetrunCard.get(i).get(3));
				returnCardVecForSawp.add(myRA_1);
			}
		}

		judgeLAIZHI_BOMB(mCardIsLaizi, Card.Point0); // 癞子炸弹可以大过
		judgeBOMB(mCardWithNoLaizi, Card.Point0);
		judgeMIX_BOMB(mCardWithNoLaizi, pCardReturn_LaiZi.mCardHead.getPoint());

		if (!returnCardVecForSawp.isEmpty()) {
			for (int i = 0; i < returnCardVecForSawp.size(); ++i) {
				mReturnCardVec.add(returnCardVecForSawp.get(i));
			}
		}
	}

	public void autoPAIR_CHAIN(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		// -------------------------------------------- 全癞子组成
		if (mCardIsLaizi.size() >= pCardReturn_LaiZi.mCardNum) {
			for (int i = 0; i < mCardIsLaizi.size(); ++i) {
				if (pCardReturn_LaiZi.mCardHead.getPoint() > Card.Point2) {
					break;
				}

				if (mCardIsLaizi.get(0).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()
						&& i + pCardReturn_LaiZi.mCardNum < mCardIsLaizi.size()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(mCardIsLaizi.get(0));
					for (int n = i + 1; n < i + pCardReturn_LaiZi.mCardNum; ++n) {
						myVec.add(mCardIsLaizi.get(i));
					}
					if (myVec.size() == pCardReturn_LaiZi.mCardNum) {
						mReturnCardVec.add(myVec);
					}
				}
			}
		}
		// --------------------------------------------
		ArrayList<SRange> myRangeVec = new ArrayList<SRange>();

		for (int i = 0; i < mCardWithNoLaizi.size(); ++i) // 找到所有可以组合的队列
		{
			if (mCardWithNoLaizi.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				int iH = mCardWithNoLaizi.get(i).getPoint();
				if ((iH < Card.Point2)
						&& ((iH - pCardReturn_LaiZi.mCardNum / 2) >= Card.Point3)) // 去除非法条件
				{
					if (myRangeVec.isEmpty()) {
						SRange myRa = new SRange();
						myRa.hight = iH;
						myRa.low = iH - pCardReturn_LaiZi.mCardNum / 2 + 1;
						myRangeVec.add(myRa);
					} else if (iH != myRangeVec.get(myRangeVec.size() - 1).hight) // 去除加过一次的数据
					{
						SRange myRa = new SRange();
						myRa.hight = iH;
						myRa.low = iH - pCardReturn_LaiZi.mCardNum / 2 + 1;
						myRangeVec.add(myRa);
					}
				}
			}
		}

		ArrayList<ArrayList<Card>> myTestForNoLaiZiVec = new ArrayList<ArrayList<Card>>();// 为非癞子所需的序列做准备，方便之后放入最后

		for (int i = 0; i < myRangeVec.size(); ++i)// 遍历每个队列查看可行性
		{
			ArrayList<Card> myVec = new ArrayList<Card>();
			for (int j = 0; j < (int) mCardWithNoLaizi.size(); ++j) {
				if (mCardWithNoLaizi.get(j).getPoint() > myRangeVec.get(i).hight
						|| mCardWithNoLaizi.get(j).getPoint() < myRangeVec
								.get(i).low)
					continue;

				if (myVec.size() < 2) {
					myVec.add(mCardWithNoLaizi.get(j));
				} else if (mCardWithNoLaizi.get(j).getPoint() != myVec.get(
						myVec.size() - 2).getPoint()) {
					myVec.add(mCardWithNoLaizi.get(j));
				}
			}
			int iNeed = pCardReturn_LaiZi.mCardNum - myVec.size();// 非癞子序列先排除。最后去添加

			if (myVec.size() + mCardIsLaizi.size() >= pCardReturn_LaiZi.mCardNum
					&& mCardIsLaizi.size() >= iNeed) {
				for (int k = 0; k < iNeed; ++k) {
					myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1 - k));
				}
			}
			if (iNeed == 0) {
				myTestForNoLaiZiVec.add(myVec);
			} else if (myVec.size() == pCardReturn_LaiZi.mCardNum) {
				mReturnCardVec.add(myVec);
			}
		}

		// -------------------------------------------没有癞子
		for (int i = 0; i < myTestForNoLaiZiVec.size(); ++i) {
			if (myTestForNoLaiZiVec.get(i).size() == pCardReturn_LaiZi.mCardNum) {
				mReturnCardVec.add(myTestForNoLaiZiVec.get(i));
			}
		}
	}

	public void autoCHAIN(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		// -------------------------------------------- 全癞子组成
		if (mCardIsLaizi.size() >= pCardReturn_LaiZi.mCardNum) {
			for (int i = 0; i < mCardIsLaizi.size(); ++i) {
				if (pCardReturn_LaiZi.mCardHead.getPoint() > Card.Point2) {
					break;
				}

				if (mCardIsLaizi.get(0).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()
						&& i + pCardReturn_LaiZi.mCardNum < mCardIsLaizi.size()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(mCardIsLaizi.get(0));
					for (int n = i + 1; n < i + pCardReturn_LaiZi.mCardNum; ++n) {
						myVec.add(mCardIsLaizi.get(i));
					}
					if (myVec.size() == pCardReturn_LaiZi.mCardNum) {
						mReturnCardVec.add(myVec);
					}
				}
			}
		}

		// -------------------------------------------- 部分非癞子
		ArrayList<SRange> myRangeVec = new ArrayList<SRange>();

		for (int i = 0; i < mCardWithNoLaizi.size(); ++i) // 找到所有可以组合的队列
		{
			if (mCardWithNoLaizi.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				int iH = mCardWithNoLaizi.get(i).getPoint();
				if ((iH < Card.Point2)
						&& ((iH - pCardReturn_LaiZi.mCardNum) >= Card.Point3)) // 去除非法条件
				{
					if (myRangeVec.isEmpty()) {
						SRange myRa = new SRange();
						myRa.hight = iH;
						myRa.low = iH - pCardReturn_LaiZi.mCardNum + 1;
						myRangeVec.add(myRa);
					} else if (iH != myRangeVec.get(myRangeVec.size() - 1).hight) // 去除加过一次的数据
					{
						SRange myRa = new SRange();
						myRa.hight = iH;
						myRa.low = iH - pCardReturn_LaiZi.mCardNum + 1;
						myRangeVec.add(myRa);
					}
				}
			}
		}
		ArrayList<ArrayList<Card>> myTestForNoLaiZiVec = new ArrayList<ArrayList<Card>>();// 为非癞子所需的序列做准备，方便之后放入最后

		for (int i = 0; i < myRangeVec.size(); ++i)// 遍历每个队列查看可行性
		{
			ArrayList<Card> myVec = new ArrayList<Card>();
			for (int j = 0; j < mCardWithNoLaizi.size(); ++j) {
				if ((mCardWithNoLaizi.get(j).getPoint() > myRangeVec.get(i).hight)
						|| (mCardWithNoLaizi.get(j).getPoint() < myRangeVec
								.get(i).low))
					continue;

				if (myVec.isEmpty()) {
					myVec.add(mCardWithNoLaizi.get(j));
				} else if (mCardWithNoLaizi.get(j).getPoint() != myVec.get(
						myVec.size() - 1).getPoint()) {// 为啥不加尾部的呢？
					myVec.add(mCardWithNoLaizi.get(j));
				}
			}
			int iNeed = pCardReturn_LaiZi.mCardNum - myVec.size();// 非癞子序列先排除。最后去添加

			if (myVec.size() + mCardIsLaizi.size() >= pCardReturn_LaiZi.mCardNum
					&& mCardIsLaizi.size() >= iNeed) {
				for (int k = 0; k < iNeed; ++k) {
					myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1 - k));
				}
			}
			if (iNeed == 0) {
				myTestForNoLaiZiVec.add(myVec);
			} else if (myVec.size() == pCardReturn_LaiZi.mCardNum) {
				// 说明：前面进行了合适区间的判断，然后加癞子又能凑成对应的牌数，也就保证打起，然后又凑完整了
				mReturnCardVec.add(myVec);
			}
		}
		// --------------------------------------------

		// -------------------------------------------没有癞子
		for (int i = 0; i < myTestForNoLaiZiVec.size(); ++i) {
			if (myTestForNoLaiZiVec.get(i).size() == pCardReturn_LaiZi.mCardNum) {
				mReturnCardVec.add(myTestForNoLaiZiVec.get(i));
			}
		}
	}

	public void autoPLANE(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		// -------------------------------------------- 全癞子组成
		if (mCardIsLaizi.size() >= pCardReturn_LaiZi.mCardNum) {
			for (int i = 0; i < mCardIsLaizi.size(); ++i) {
				if (pCardReturn_LaiZi.mCardHead.getPoint() > Card.Point2) {
					break;
				}

				if (mCardIsLaizi.get(0).getPoint() > pCardReturn_LaiZi.mCardHead
						.getPoint()
						&& i + pCardReturn_LaiZi.mCardNum < mCardIsLaizi.size()) {
					ArrayList<Card> myVec = new ArrayList<Card>();
					myVec.add(mCardIsLaizi.get(0));
					for (int n = i + 1; n < i + pCardReturn_LaiZi.mCardNum; ++n) {
						myVec.add(mCardIsLaizi.get(i));
					}
					if (myVec.size() == pCardReturn_LaiZi.mCardNum) {
						mReturnCardVec.add(myVec);
					}
				}
			}
		}
		// --------------------------------------------
		ArrayList<SRange> myRangeVec = new ArrayList<SRange>();

		for (int i = 0; i < mCardWithNoLaizi.size(); ++i) // 找到所有可以组合的队列
		{
			if (mCardWithNoLaizi.get(i).getPoint() > pCardReturn_LaiZi.mCardHead
					.getPoint()) {
				int iH = mCardWithNoLaizi.get(i).getPoint();
				if ((iH < Card.Point2)
						&& ((iH - pCardReturn_LaiZi.mCardNum / 3) >= Card.Point3)) // 去除非法条件
				{
					if (myRangeVec.isEmpty()) {
						SRange myRa = new SRange();
						myRa.hight = iH;
						myRa.low = iH - pCardReturn_LaiZi.mCardNum / 3 + 1;
						myRangeVec.add(myRa);
					} else if (iH != myRangeVec.get(myRangeVec.size() - 1).hight) // 去除加过一次的数据
					{
						SRange myRa = new SRange();
						myRa.hight = iH;
						myRa.low = iH - pCardReturn_LaiZi.mCardNum / 3 + 1;
						myRangeVec.add(myRa);
					}
				}
			}
		}

		ArrayList<ArrayList<Card>> myTestForNoLaiZiVec = new ArrayList<ArrayList<Card>>();// 为非癞子所需的序列做准备，方便之后放入最后

		for (int i = 0; i < myRangeVec.size(); ++i)// 遍历每个队列查看可行性
		{
			ArrayList<Card> myVec = new ArrayList<Card>();
			for (int j = 0; j < mCardWithNoLaizi.size(); ++j) {
				if ((mCardWithNoLaizi.get(j).getPoint() > myRangeVec.get(i).hight)
						|| (mCardWithNoLaizi.get(j).getPoint() < myRangeVec
								.get(i).low))
					continue;

				if (myVec.size() < 3) {
					myVec.add(mCardWithNoLaizi.get(j));
				} else if (mCardWithNoLaizi.get(j).getPoint() != myVec.get(
						myVec.size() - 3).getPoint()) {
					myVec.add(mCardWithNoLaizi.get(j));
				}
			}
			int iNeed = pCardReturn_LaiZi.mCardNum - myVec.size();// 非癞子序列先排除。最后去添加

			if (myVec.size() + mCardIsLaizi.size() >= pCardReturn_LaiZi.mCardNum
					&& mCardIsLaizi.size() >= iNeed) {
				for (int k = 0; k < iNeed; ++k) {
					myVec.add(mCardIsLaizi.get(mCardIsLaizi.size() - 1 - k));
				}
			}
			if (iNeed == 0) {
				myTestForNoLaiZiVec.add(myVec);
			} else if (myVec.size() == pCardReturn_LaiZi.mCardNum) {
				mReturnCardVec.add(myVec);
			}
		}

		// -------------------------------------------没有癞子
		for (int i = 0; i < myTestForNoLaiZiVec.size(); ++i) {
			mReturnCardVec.add(myTestForNoLaiZiVec.get(i));
		}
	}

	public void autoPLANE_1(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		CardReturn_Laizi myReturn_LaiziCopy = new CardReturn_Laizi();
		myReturn_LaiziCopy.copy(CardType_Laizi.PLANE,
				pCardReturn_LaiZi.mCardHead,
				(pCardReturn_LaiZi.mCardNum / 4) * 3);

		autoPLANE(pCard, myReturn_LaiziCopy);
		ArrayList<ArrayList<Card>> myReturnCardCopy = new ArrayList<ArrayList<Card>>();

		for (int i = 0; i < mReturnCardVec.size(); ++i) {
			if (mReturnCardVec.get(i).size() > 5)
				myReturnCardCopy
						.add(CardAssist.copyList(mReturnCardVec.get(i)));
		}
		mReturnCardVec.clear();

		for (int i = 0; i < myReturnCardCopy.size(); ++i) {
			ArrayList<Card> myMainCardCopy = CardAssist.copyList(pCard);
			CardAuto.myEarseVec(myMainCardCopy, myReturnCardCopy.get(i));
			CardAuto.myEarseKillBomb(myMainCardCopy);// 拆掉王炸

			// 还需补充的单张数
			int iNeed = pCardReturn_LaiZi.mCardNum / 4;
			if (myMainCardCopy.size() < iNeed)
				break;
			// ------------------------------------------分解有无癞子
			ArrayList<Card> myNoLaiZi = new ArrayList<Card>();
			ArrayList<Card> myLaiZi = new ArrayList<Card>();
			for (int j = 0; j < myMainCardCopy.size(); ++j) {
				if (myMainCardCopy.get(j).isLaiZi()) {
					myLaiZi.add(myMainCardCopy.get(j));
					continue;
				}
				myNoLaiZi.add(myMainCardCopy.get(j));
			}
			// --------------------------------------------------
			// ------------------------------------------------------细分
			ArrayList<Card> FourVec = new ArrayList<Card>();
			ArrayList<Card> ThreeVec = new ArrayList<Card>();
			ArrayList<Card> twoVec = new ArrayList<Card>();
			ArrayList<Card> OneVec = new ArrayList<Card>();
			explainVec(myNoLaiZi, FourVec, ThreeVec, twoVec, OneVec);
			// ------------------------------------------------------------------------
			for (int j = 0; j < OneVec.size(); ++j) {
				if (iNeed == 0)
					break;
				myReturnCardCopy.get(i).add(OneVec.get(j));
				iNeed--;
			}

			for (int j = 0; j < twoVec.size(); ++j) {
				if (iNeed == 0)
					break;
				myReturnCardCopy.get(i).add(twoVec.get(j));
				iNeed--;
			}

			for (int j = 0; j < ThreeVec.size(); ++j) {
				if (iNeed == 0)
					break;
				myReturnCardCopy.get(i).add(ThreeVec.get(j));
				iNeed--;
			}

			for (int j = 0; j < myLaiZi.size(); ++j) {
				if (iNeed == 0)
					break;
				myReturnCardCopy.get(i).add(myLaiZi.get(j));
				iNeed--;
			}

			for (int j = 0; j < FourVec.size(); ++j) {
				if (iNeed == 0)
					break;
				myReturnCardCopy.get(i).add(FourVec.get(j));
				iNeed--;
			}
		}

		judgeLAIZHI_BOMB(mCardIsLaizi, Card.Point0); // 癞子炸弹可以大过
		judgeBOMB(mCardWithNoLaizi, Card.Point0);
		judgeMIX_BOMB(mCardWithNoLaizi, pCardReturn_LaiZi.mCardHead.getPoint());

		for (int i = 0; i < myReturnCardCopy.size(); ++i) {
			if (myReturnCardCopy.get(i).size() == pCardReturn_LaiZi.mCardNum) {
				mReturnCardVec.add(myReturnCardCopy.get(i));
			}
		}
	}

	public void autoPLANE_2(final ArrayList<Card> pCard,
			CardReturn_Laizi pCardReturn_LaiZi) {
		CardReturn_Laizi myReturn_LaiziCopy = new CardReturn_Laizi();
		myReturn_LaiziCopy.copy(CardType_Laizi.PLANE,
				pCardReturn_LaiZi.mCardHead,
				(pCardReturn_LaiZi.mCardNum / 5) * 3);
		autoPLANE(pCard, myReturn_LaiziCopy);
		ArrayList<ArrayList<Card>> myReturnCardCopy = new ArrayList<ArrayList<Card>>();

		for (int i = 0; i < mReturnCardVec.size(); ++i) {
			if (mReturnCardVec.get(i).size() > 5)
				myReturnCardCopy
						.add(CardAssist.copyList(mReturnCardVec.get(i)));
		}
		mReturnCardVec.clear();

		for (int i = 0; i < myReturnCardCopy.size(); ++i) {
			ArrayList<Card> myMainCardCopy = CardAssist.copyList(pCard);
			CardAuto.myEarseVec(myMainCardCopy, myReturnCardCopy.get(i)); // 删除飞机
			CardAuto.myEarseKillBomb(myMainCardCopy);// 拆掉王炸

			int iNeed = (pCardReturn_LaiZi.mCardNum / 5) * 2;

			if (myMainCardCopy.size() < iNeed) {
				break;
			}
			// --------------------------------------------------------------
			for (int j = 0; j < pCardReturn_LaiZi.mCardNum / 5; ++j) {
				ArrayList<Card> myPair = myAddPair(myMainCardCopy);

				if (myPair.isEmpty()) {// 判断找不到对子了
					break;
				}
				myReturnCardCopy.get(i).add(myPair.get(0));
				myReturnCardCopy.get(i).add(myPair.get(1));
				iNeed = iNeed - 2;
				CardAuto.myEarseVec(myMainCardCopy, myPair);
			}
		}
		judgeLAIZHI_BOMB(mCardIsLaizi, Card.Point0); // 癞子炸弹可以大过
		judgeBOMB(mCardWithNoLaizi, Card.Point0);
		judgeMIX_BOMB(mCardWithNoLaizi, pCardReturn_LaiZi.mCardHead.getPoint());

		for (int i = 0; i < myReturnCardCopy.size(); ++i) {
			if (myReturnCardCopy.get(i).size() == pCardReturn_LaiZi.mCardNum) {
				mReturnCardVec.add(myReturnCardCopy.get(i));
			}
		}
	}

	// CardAuto_3 m_WithNoLaiZiAuto;
	public void explainVec(final ArrayList<Card> mainVec,
			ArrayList<Card> fourVec, ArrayList<Card> threeVec,
			ArrayList<Card> twoVec, ArrayList<Card> oneVec) {
		ArrayList<Card> myMain = CardAssist.copyList(mainVec);
		for (int i = 0; i < myMain.size() - 3;) {
			if ((i + 3 < myMain.size())) {
				if (myMain.get(i).getPoint() == myMain.get(i + 3).getPoint()) {
					fourVec.add(myMain.get(i));
					fourVec.add(myMain.get(i + 1));
					fourVec.add(myMain.get(i + 2));
					fourVec.add(myMain.get(i + 3));

					myMain.remove(myMain.get(i));
					myMain.remove(myMain.get(i));
					myMain.remove(myMain.get(i));
					myMain.remove(myMain.get(i));

					i = 0;
				} else {
					++i;
				}
			} else {
				break;
			}
		}

		for (int i = 0; i < (int) myMain.size() - 2;) {
			if ((i + 2 < myMain.size())) {
				if (myMain.get(i).getPoint() == myMain.get(i + 2).getPoint()) {
					threeVec.add(myMain.get(i));
					threeVec.add(myMain.get(i + 1));
					threeVec.add(myMain.get(i + 2));

					myMain.remove(myMain.get(i));
					myMain.remove(myMain.get(i));
					myMain.remove(myMain.get(i));

					i = 0;
				} else {
					++i;
				}
			} else {
				break;
			}
		}

		for (int i = 0; i < (int) myMain.size() - 1;) {
			if ((i + 1 < myMain.size())) {
				if (myMain.get(i).getPoint() == myMain.get(i + 1).getPoint()) {
					twoVec.add(myMain.get(i));
					twoVec.add(myMain.get(i + 1));

					myMain.remove(myMain.get(i));
					myMain.remove(myMain.get(i));
					i = 0;
				} else {
					++i;
				}
			} else {
				break;
			}
		}

		for (int i = 0; i < myMain.size(); ++i) {
			oneVec.add(myMain.get(i));
		}
	}

	/** 抽出所有的癞子炸弹 **/
	public void judgeLAIZHI_BOMB(final ArrayList<Card> myVec, int cHead) {
		for (int i = 0; i < (int) myVec.size() - 3; ++i) {
			if ((i + 3 < myVec.size()) && (myVec.get(i).getPoint() > cHead)
					&& (myVec.get(i).getPoint() < Card.PointSmallJoker)) {
				ArrayList<Card> myTest = new ArrayList<Card>();
				myTest.add(myVec.get(i));
				myTest.add(myVec.get(i + 1));
				myTest.add(myVec.get(i + 2));
				myTest.add(myVec.get(i + 3));
				mReturnCardVec.add(myTest);
			}
		}
	}

	/** 抽出所有的普通炸弹 **/
	public void judgeBOMB(final ArrayList<Card> myVec, int cHead) {
		for (int i = 0; i < (int) myVec.size() - 3; ++i) {
			if ((myVec.get(i).getPoint() <= cHead)
					|| (myVec.get(i).getPoint() >= Card.PointSmallJoker))
				continue;

			if ((i + 3 < myVec.size())
					&& myVec.get(i).getPoint() == myVec.get(i + 3).getPoint()) {
				ArrayList<Card> myTest = new ArrayList<Card>();
				myTest.add(myVec.get(i));
				myTest.add(myVec.get(i + 1));
				myTest.add(myVec.get(i + 2));
				myTest.add(myVec.get(i + 3));
				mReturnCardVec.add(myTest);
			}
		}
	}

	/** 抽出所有混搭炸弹 **/
	public void judgeMIX_BOMB(final ArrayList<Card> myCardNoLaiziVec, int cHead) {

		ArrayList<Card> mySurplusNoLaiziCopy = CardAssist
				.copyList(myCardNoLaiziVec);
		ArrayList<Card> mySurplusLaiziCopy = CardAssist.copyList(mCardIsLaizi);
		Collections.sort(mySurplusLaiziCopy, new CardAssist.Asc());

		// 王炸，同色炸，三同，对
		ArrayList<ArrayList<ArrayList<Card>>> allCardTypeList = CardAuto
				.splitAllCard(mySurplusNoLaiziCopy);
		Collections.reverse(allCardTypeList);

		if (allCardTypeList.size() > 0) {// 肯定包括4部分数据
			allCardTypeList.remove(0);// 去掉王炸
			allCardTypeList.remove(0);// 去掉原生炸
		}

		// 对
		if (allCardTypeList.size() > 1) {
			ArrayList<ArrayList<Card>> twoTypeList = allCardTypeList.get(1);
			Collections.reverse(twoTypeList);
			for (int i = 0; i < twoTypeList.size(); i++) {
				ArrayList<Card> cards = twoTypeList.get(i);
				if (!cards.isEmpty()
						&& 2 == cards.size()
						&& cards.get(0).getPoint() > cHead
						&& (cards.get(0).getPoint() < Card.PointSmallJoker && mySurplusLaiziCopy
								.size() > 1)) {
					ArrayList<Card> mixBomb = new ArrayList<Card>();
					mixBomb.add(cards.get(0));
					mixBomb.add(cards.get(1));
					mixBomb.add(mCardIsLaizi.get(0));
					mixBomb.add(mCardIsLaizi.get(1));
					mReturnCardVec.add(mixBomb);
				}
			}
		}

		// 三同
		if (allCardTypeList.size() > 0) {
			ArrayList<ArrayList<Card>> threeTypeList = allCardTypeList.get(0);
			Collections.reverse(threeTypeList);
			for (int i = 0; i < threeTypeList.size(); i++) {
				ArrayList<Card> cards = threeTypeList.get(i);
				if (!cards.isEmpty()
						&& 3 == cards.size()
						&& cards.get(0).getPoint() > cHead
						&& (cards.get(0).getPoint() < Card.PointSmallJoker && mySurplusLaiziCopy
								.size() > 0)) {
					ArrayList<Card> mixBomb = new ArrayList<Card>();
					mixBomb.add(cards.get(0));
					mixBomb.add(cards.get(1));
					mixBomb.add(cards.get(2));
					mixBomb.add(mCardIsLaizi.get(0));
					mReturnCardVec.add(mixBomb);
				}
			}
		}

		if (allCardTypeList.size() > 2) {
			ArrayList<ArrayList<Card>> oneTypeList = allCardTypeList.get(2);
			Collections.reverse(oneTypeList);
			for (int i = 0; i < oneTypeList.size(); i++) {
				ArrayList<Card> cards = oneTypeList.get(i);
				if (!cards.isEmpty()
						&& 1 == cards.size()
						&& cards.get(0).getPoint() > cHead
						&& (cards.get(0).getPoint() < Card.PointSmallJoker && mySurplusLaiziCopy
								.size() > 2)) {
					ArrayList<Card> mixBomb = new ArrayList<Card>();
					mixBomb.add(cards.get(i));
					mixBomb.add(mCardIsLaizi.get(0));
					mixBomb.add(mCardIsLaizi.get(1));
					mixBomb.add(mCardIsLaizi.get(2));
					mReturnCardVec.add(mixBomb);
				}
			}
		}

	}

	public ArrayList<Card> myAddPair(ArrayList<Card> myCard) {
		// ------------所有对子组合
		ArrayList<Card> cReturnCard = new ArrayList<Card>();
		if (myCard.size() < 2)// 牌张数不足时候推出
			return cReturnCard;

		// ----------------- 分牌
		ArrayList<Card> myNoLaiZi = new ArrayList<Card>();
		ArrayList<Card> myLaiZi = new ArrayList<Card>();

		for (int i = 0; i < myCard.size(); ++i) {
			if (myCard.get(i).isLaiZi()) {
				myLaiZi.add(myCard.get(i));
				continue;
			}
			myNoLaiZi.add(myCard.get(i));
		}

		// ----------------------------------纯癞子组合
		if (!myLaiZi.isEmpty()) {
			for (int i = 0; i < myLaiZi.size() - 1; i = i + 2) {
				if (i + 1 < myLaiZi.size()) {
					cReturnCard.add(myLaiZi.get(i));
					cReturnCard.add(myLaiZi.get(i + 1));
				}
			}
		}
		// -------------------------------------end

		// ----------------------------------------------f分牌型
		ArrayList<Card> fourVec = new ArrayList<Card>();
		ArrayList<Card> threeVec = new ArrayList<Card>();
		ArrayList<Card> twoVec = new ArrayList<Card>();
		ArrayList<Card> oneVec = new ArrayList<Card>();
		explainVec(myNoLaiZi, fourVec, threeVec, twoVec, oneVec);

		if (!fourVec.isEmpty()) {
			for (int i = 0; i < (int) fourVec.size() - 4; i = i + 4) {
				if (i + 1 < fourVec.size()) {
					cReturnCard.add(fourVec.get(i));
					cReturnCard.add(fourVec.get(i + 1));
				}
			}
		}

		if ((!oneVec.isEmpty()) && (!myLaiZi.isEmpty())) {
			for (int i = 0; i < oneVec.size(); ++i) {
				cReturnCard.add(oneVec.get(i));
				cReturnCard.add(myLaiZi.get(myLaiZi.size() - 1));
			}
		}

		if (!threeVec.isEmpty()) {
			for (int i = 0; i < (int) threeVec.size() - 2; i = i + 3) {
				if (i + 1 < threeVec.size()) {
					cReturnCard.add(threeVec.get(i));
					cReturnCard.add(threeVec.get(i + 1));
				}
			}
		}

		if (!twoVec.isEmpty()) {
			for (int i = 0; i < (int) twoVec.size() - 1; i = i + 2) {
				if (i + 1 < twoVec.size()) {
					cReturnCard.add(twoVec.get(i));
					cReturnCard.add(twoVec.get(i + 1));
				}
			}
		}
		// -------------------
		ArrayList<Card> lastVecForReturn = new ArrayList<Card>();
		if (cReturnCard.size() >= 2) {
			lastVecForReturn.add(cReturnCard.get(cReturnCard.size() - 1));
			lastVecForReturn.add(cReturnCard.get(cReturnCard.size() - 2));
		}

		return lastVecForReturn;
	}
}
