package extend.zp.uitl;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
import java.util.Stack;

import com.game.Util;
import com.taurus.core.entity.ITArray;
import com.taurus.core.entity.ITObject;
import com.taurus.core.entity.TArray;
import com.taurus.core.entity.TObject;

import extend.zp.Config;
import extend.zp.EXPlayer;
import extend.zp.OpCard;
import extend.zp.RuleWeight;

public class CardUtil {


	public static void sendSuoCardEvent(EXPlayer owner) {
		Map<Integer, Integer> cardNumMap = Util.getCardNumMap(owner.cardInhand);
		for (Entry<Integer, Integer> entry : cardNumMap.entrySet()) {
			int keyCard = entry.getKey();
			int num = entry.getValue();
			if (num == 3) {
				owner.suoCardList.add(keyCard);
			}
		}
		ITArray paramArray = TArray.newInstance();
		for (int suoCard : owner.suoCardList) {
			paramArray.addInt(suoCard);
		}
		ITObject param = new TObject();
		param.putTArray("suoCard", paramArray);
		owner.sendEvent(Config.GAME_PLAYER_SUOPAI, param);
	}
	
	
	static public boolean checkCard(int eventCard,Map<Integer, Integer> cardMap) {
		if(cardMap.containsKey(eventCard)&&cardMap.get(eventCard)>=1) {
			return true;
		}
		return false;
	}
	
	static public void addCard(int eventCard,Map<Integer, Integer> cardMap,int add) {
		if(cardMap.containsKey(eventCard)) {
			int num = cardMap.get(eventCard);
			cardMap.put(eventCard, num+add);
		}else if(add >0){
			cardMap.put(eventCard, add);
		}
	}
	
	static public int checkQingyise(List<OpCard> opCards, Stack<OpCard> cgList) {
		int se = 0;
		for (OpCard card : opCards) {
			if(se==0) {
				se = card.card1 / 100;
				continue;
			}
			if (se != card.card1 / 100) {
				return 0;
			}
		}
		for (OpCard cg : cgList) {
			if(se==0) {
				se = cg.card1 / 100;
				continue;
			}
			if (se != cg.card1 / 100) {
				return 0;
			}
		}
		return se;
	}
	
	
	static public boolean checkContainHong(List<OpCard> opCards, Stack<OpCard> cgList) {
		boolean hong = true;
		for (OpCard card : opCards) {
			List<Integer> list = new ArrayList<Integer>();
			list.add(card.card1 % 100);
			list.add(card.card2 % 100);
			list.add(card.card3 % 100);
			if(!list.contains(2) && !list.contains(7) && !list.contains(10)) {
				hong = false;
				break;
			}
		}
		if(!hong)
			return hong;
		for (OpCard cg : cgList) {
			List<Integer> list = new ArrayList<Integer>();
			list.add(cg.card1 % 100);
			list.add(cg.card2 % 100);
			if (cg.card3 > 0) list.add(cg.card3 % 100);
			if(!list.contains(2) && !list.contains(7) && !list.contains(10)) {
				hong = false;
				break;
			}
		}
		return hong;
	}
	
	/**
	 * @return 1.������  2.��ǣ�� 3.�汳���� 4.���β 5.�ٷ��β
	 */
	public static int checkSpecialDuiDaoHu(List<OpCard> opCards, Stack<OpCard> cgList, int winCard) {
		int card = 0, jiangCard = 0;
		for (OpCard opCard : cgList) {
			if (opCard.type == RuleWeight.TYPE_JIANG) {
				jiangCard = opCard.card1;
			}else if (opCard.type  == RuleWeight.TYPE_PONG && winCard == opCard.card1) {
				card = winCard;
			}
		}
		if (card == 0) {
			for (OpCard opCard : opCards) {
				if (opCard.type == RuleWeight.TYPE_WEI  
						&& winCard == opCard.card1 ) {
					card = winCard;
					break;
				}
			}
		}
		if (jiangCard % 100 == card % 100) {
			if (jiangCard % 100 == 8) return 3;
			return 1;
		}else if (Math.abs(jiangCard % 100 - card % 100) == 1 && jiangCard / 100 == card / 100) {
			return 2;
		}else if ((jiangCard % 100 == 1 || jiangCard % 100 == 10) && (card % 100 == 1 || card % 100 == 10)) {
			if ((jiangCard % 100 == 1 && card % 100 == 10) || (jiangCard % 100 == 10 && card % 100 == 1)) {
				if (card / 100 == jiangCard / 100) {
					return 4;
				}else {
					return 5;
				}
			}
		}
		return 0;
	}
	
	public static boolean checkYuanYuanDing(List<OpCard> opCards, Stack<OpCard> cgList, int winCard) {
		List<Integer> cardList = new ArrayList<Integer>();
		for (OpCard opCard : cgList) {
			if (opCard.type == RuleWeight.TYPE_JIANG && opCard.card1 != winCard) return false;
			cardList.add(opCard.card1);
			cardList.add(opCard.card2);
			if (opCard.card3 > 0) cardList.add(opCard.card3);
		}
		for (OpCard opCard : opCards) {
			if (opCard.type == RuleWeight.TYPE_CHOW) {
				cardList.add(opCard.card2);
				cardList.add(opCard.card3);
			}
		}
		if (Util.checkCard(winCard, cardList, 4)) return true;
		return false;
	}
	
	public static boolean checkPiaoDui(List<OpCard> opCards, Stack<OpCard> cgList) {
		for (OpCard opCard : opCards) {
			if (checkHongCard(opCard.card1)) {
				return true;
			}
		}
		for (OpCard opCard : cgList) {
			if (opCard.type == RuleWeight.TYPE_PONG && checkHongCard(opCard.card1)) {
				return true;
			}
		}
		return false;
	}
	
	public static boolean checkXinLianXin(List<OpCard> opCards, Stack<OpCard> cgList) {
		List<List<Integer>> shunZiList = new ArrayList<>();
		for (OpCard opCard : cgList) {
			if (opCard.type == RuleWeight.TYPE_CHOW) {
				List<Integer> list = new ArrayList<>();
				list.add(opCard.card1);
				list.add(opCard.card2);
				list.add(opCard.card3);
				shunZiList.add(list);
			}
		}
		for (OpCard opCard : opCards) {
			if (opCard.type == RuleWeight.TYPE_CHOW) {
				List<Integer> list = new ArrayList<>();
				list.add(opCard.card1);
				list.add(opCard.card2);
				list.add(opCard.card3);
				shunZiList.add(list);
			}
		}
		while (true) {
			if (shunZiList.size() <= 1) break;
			List<Integer> remove = shunZiList.remove(0);
			for (List<Integer>  sz : shunZiList) {
				int min = Collections.min(remove);
				int min2 = Collections.min(sz);
				if (min + (min < min2 ? 2 : -2) == min2) return true;
			}
		}
		return false;
	}
	
	public static boolean checkJiDing(Stack<OpCard> cgList, int winCard) {
		List<Integer> list = new ArrayList<>();
		for (OpCard opCard : cgList) {
			if (opCard.type == RuleWeight.TYPE_CHOW) {
				list.clear();
				list.add(opCard.card1);
				list.add(opCard.card2);
				list.add(opCard.card3);
				if (Collections.min(list) + 1 == winCard) return true;
			}
		}
		return false;
	}
	
	static public Set<Integer> checkTuanYuan(List<OpCard> opCards, Stack<OpCard> cgList) {
		Set<Integer> threeCard = new HashSet<Integer>();
		Set<Integer> otherCard = new HashSet<Integer>();
		for (OpCard card : opCards) {
			Set<Integer> set = new HashSet<Integer>();
			set.add(card.card1);
			set.add(card.card2);
			set.add(card.card3);
			if(set.size() == 1) {
				threeCard.addAll(set);
			} else {
				otherCard.addAll(set);
			}
		}
		for (OpCard cg : cgList) {
			Set<Integer> set = new HashSet<Integer>();
			set.add(cg.card1);
			set.add(cg.card2);
			if (cg.card3 == 0) continue;
			set.add(cg.card3);
			if(set.size() == 1) {
				threeCard.addAll(set);
			} else {
				otherCard.addAll(set);
			}
		}
		threeCard.retainAll(otherCard);
		return threeCard;
	}
	
	static public boolean checkErXiManHuaYuan(List<OpCard> opCards, List<OpCard> cgList) {
		List<Integer> cards = new ArrayList<Integer>();
		boolean result = true;
		int pairCard = 0;
		for (OpCard card : opCards) {
			Set<Integer> set = new HashSet<Integer>();
			set.add(card.card1);
			set.add(card.card2);
			set.add(card.card3);
			boolean hong = false;
			for(int ca : set) {
				if(checkHongCard(ca)) {
					cards.add(ca);
					hong = true;
				}
			}
			if(!hong)
				result = false;
		}
		if(!result)
			return result;
		for (OpCard cg : cgList) {
			Set<Integer> set = new HashSet<Integer>();
			set.add(cg.card1);
			set.add(cg.card2);
			if (cg.card3 > 0)set.add(cg.card3);
			boolean hong = false;
			for(int ca : set) {
				if(checkHongCard(ca)) {
					cards.add(ca);
					hong = true;
				}
			}
			if(!hong)
				result = false;
		}
		if(!result)
			return result;
		if(!checkHongCard(pairCard))
			return false;
		if(cards.contains(pairCard)) {
			Integer num = Util.getCardNumMap(cards).get(pairCard);
			if(num != 3) {
				return true;
			} else {
				return false;
			}
		} else {
			return true;
		}
	}
	
	static public int getHongCardNum(List<Integer> cardInhand,List<OpCard> opCards) {
		int count = 0;
		for(Integer card : cardInhand) {
			if(checkHongCard(card))count++;
		}
		for(OpCard opc : opCards) {
			if(checkHongCard(opc.card1))count++;
			if(checkHongCard(opc.card2))count++;
			if(checkHongCard(opc.card3))count++;
		}
		return count;
	}
	
	static public final boolean checkHongCard(int card) {
		int mod_card = card % 100;
		if(mod_card == 2 || mod_card == 7 || mod_card == 10)return true;
		return false;
	}
	
	public static int checkHieHongZhaDan(List<Integer> cardList) {
		int result = 0;
		Map<Integer, Integer> cardNumMap = Util.getCardNumMap(cardList);
		for (Entry<Integer, Integer> entry : cardNumMap.entrySet()) {
			if (entry.getValue() == 4) {
				int bomb = entry.getKey(), temp = 0;
				for (Integer card : cardList) {
					if (card != bomb && Math.abs(bomb - card) <= 2) {
						temp++;
						break;
					}
				}
				if (temp == 0) {
					if (CardUtil.checkHongCard(bomb)) return 2;
					result = 1;
				}
			}
		}
		return result;
	}
	
	public static boolean checkManYuanHua(List<OpCard> opCards) {
		for (OpCard opCard : opCards) {
			int hongNum = 0;
			if (checkHongCard(opCard.card1)) hongNum++;
			if (checkHongCard(opCard.card2)) hongNum++;
			if (opCard.card3 > 0 && checkHongCard(opCard.card3)) hongNum++;
			if (hongNum == 0) return false;
		}
		return true;
	}
	
	static public List<Integer> getCardGroupHuxi1(List<Integer> chowGroup, List<OpCard> opCardList) {
		int self = 0, others = 0;
		List<Integer> result = new ArrayList<>();
		for (OpCard opCard : opCardList) {
			if (opCard.type == RuleWeight.TYPE_WEI ) {
				if (chowGroup.contains(opCard.card1)) {
					int huxi = checkHongCard(opCard.card1) ? 8 : 6;
					self += huxi - opCard.huXi;
					opCard.huXi = huxi;
				}
			}else if (opCard.type == RuleWeight.TYPE_PONG) {
				if (chowGroup.contains(opCard.card1)) {
					int huxi = checkHongCard(opCard.card1) ? 7 : 5;
					self += huxi - opCard.huXi;
					others += huxi - opCard.huXi;
					opCard.huXi = huxi;
				}
			}
		}
		result.add(self);
		result.add(others);
		return result;
	}
	
	static public int getCardGroupHuxi(int card,int type, List<OpCard> opCardList) {
		int huXi = 0;
		switch(type) {
		case RuleWeight.TYPE_WEI:
		case RuleWeight.TYPE_CHOUWEI:
			for (OpCard opCard : opCardList) {
				if (opCard.type == RuleWeight.TYPE_CHOW &&
						(opCard.card1 == card || opCard.card2 == card || opCard.card3 == card)) {
					huXi = checkHongCard(card) ? 8 : 6;
				}
			}
			if (huXi == 0) huXi = checkHongCard(card) ? 4 : 3;
			return huXi;
		case RuleWeight.TYPE_KAN:
			return huXi = checkHongCard(card) ? 4 : 3;
		case RuleWeight.TYPE_PONG:
			for (OpCard opCard : opCardList) {
				if (opCard.type == RuleWeight.TYPE_CHOW &&
						(opCard.card1 == card || opCard.card2 == card || opCard.card3 == card)) {
					huXi = checkHongCard(card) ? 7 : 5;
					break;
				}
			}
			if (huXi == 0) huXi = checkHongCard(card) ? 3 : 2;
			return huXi;
		}
		return huXi;
	}
	
	static public int huxiToScore(int huxi) {
		int xi = 0;
		/*if(huxi > 21) return 3 + (huxi - 21) /3;
		if(huxi == 21) return 3;
		if(huxi >= 16) return 2;
		if(huxi >= 10) return 1;*/
		xi = huxi /10;
		return xi;
	}
	
	static public boolean checkHandKan(List<Integer> cardInhand) {
		Map<Integer, Integer> cardMap = Util.getCardNumMap(cardInhand);
		for(Integer num : cardMap.values()) {
			if(num != 3) return false;
		}
		return true;
	}
	
	public final static Random random	= new Random();
	static {
		random.setSeed(System.currentTimeMillis());
	}
	static public int randomDiceNum() {
		int result = random.nextInt(5);
		return result + 1;
	}


	public static boolean checkWuXi(List<Integer> cardList) {
		Map<Integer, Integer> cardNumMap = Util.getCardNumMap(cardList);
		List<Integer > twoList = new ArrayList<>(), cCardList = new ArrayList<>();
		int hong = 0;
		for (Entry<Integer, Integer> entry : cardNumMap.entrySet()) {
			int card = entry.getKey();
			int num = entry.getValue();
			if (num >= 2) {
				if (checkHongCard(card)) hong++;
				twoList.add(card);
			}else {
				//if (checkHongCard(card)) other += num;
				cCardList.add(card);
			}
		}
		if (twoList.size() == 0) {
			return true;
		}else if (twoList.size() == 1) {
			if (hong == 1) {
				int card = twoList.get(0);
				int frequency = Collections.frequency(cardList, card);
				if (frequency > 2) {
					for (Integer c : cCardList) {
						int abs = Math.abs(card - c);
						if (abs > 0 && abs <= 2) return false;
					}
				}else if (kaoCard(card, cardList)) {
					return false;
				}
			}
			return true;
		}else if (twoList.size() == 2) {
			if (hong == 0) {
				for (Integer c : twoList) {
					int frequency = Collections.frequency(cardList, c);
					if (frequency > 2) {
						for (Integer card : cCardList) {
							int abs = Math.abs(card - c);
							if (abs > 0 && abs <= 2) return false;
						}
					}else if (kaoCard(c, cardList)) {
						return false;
					}
				}
				return true;
			}
		}
		return false;
	}
	
	public static boolean kaoCard(int card, List<Integer> cardList) {
		if ((CardUtil.cardNum(card - 2, cardList) >= 1 && CardUtil.cardNum(card - 1, cardList) >= 1) || 
				(CardUtil.cardNum(card + 1, cardList) >= 1 && CardUtil.cardNum(card + 2, cardList) >= 1) ||
				(CardUtil.cardNum(card - 1, cardList) >= 1 && CardUtil.cardNum(card + 1, cardList) >= 1)) 
			return true;
		return false;
	}
	

	public static boolean removeCard(List<Integer> cardList, List<Integer> removeCardList) {
		List<Integer> list = new ArrayList<>(cardList);
		int removeNum = 0;
		for (int i = 0; i < removeCardList.size(); i++) {
			for (int j = 0; j < cardList.size(); j++) {
				if (cardList.get(j).equals(removeCardList.get(i))) {
					cardList.remove(j);
					removeNum++;
					break;
				}
			}
		}
		if (removeNum < removeCardList.size()) {
			cardList.clear();
			cardList.addAll(list);
			return false;
		}
		return true;
	}
	

	static public List<Integer> seekAppropriate(int eventCard, List<Integer> cardList) {
		List<Integer> result = new ArrayList<>();
		for (Integer card : cardList) {
			if (Math.abs(eventCard - card) <= 2 && card != eventCard) {
				result.add(card);
				result.add(eventCard);
				Collections.sort(result);
				break;
			}
		}
		return result;
	}
	

	static public List<List<Integer>> seekAppropriate2(int eventCard, List<Integer> cardList) {
		List<List<Integer>> result = new ArrayList<>();
		if (!(eventCard % 100 == 2 || eventCard % 100 == 7 || eventCard % 100 == 10)) return result;
		if (eventCard % 100 == 2) {
			if (CardUtil.cardNum(eventCard + 5, cardList) > 0) {
				List<Integer> list = new ArrayList<>();
				list.add(eventCard);
				list.add(eventCard + 5);
				result.add(list);
			}
			if (CardUtil.cardNum(eventCard + 8, cardList) > 0) {
				List<Integer> list = new ArrayList<>();
				list.add(eventCard);
				list.add(eventCard + 8);
				result.add(list);
			}
		}else if (eventCard % 100 == 7) {
			if (CardUtil.cardNum(eventCard - 5, cardList) > 0) {
				List<Integer> list = new ArrayList<>();
				list.add(eventCard);
				list.add(eventCard - 5);
				result.add(list);
			}
			if (CardUtil.cardNum(eventCard + 3, cardList) > 0) {
				List<Integer> list = new ArrayList<>();
				list.add(eventCard);
				list.add(eventCard + 3);
				result.add(list);
			}
		}else if (eventCard % 100 == 10) {
			if (CardUtil.cardNum(eventCard - 3, cardList) > 0) {
				List<Integer> list = new ArrayList<>();
				list.add(eventCard);
				list.add(eventCard - 3);
				result.add(list);
			}
			if (CardUtil.cardNum(eventCard - 8, cardList) > 0) {
				List<Integer> list = new ArrayList<>();
				list.add(eventCard);
				list.add(eventCard - 8);
				result.add(list);
			}
		}
		
		return result;
	}
	

	static public List<Integer> seekAppropriate1(int eventCard, List<Integer> cardList) {
		List<Integer> result = new ArrayList<>();
		if (!(eventCard % 100 == 2 || eventCard % 100 == 7 || eventCard % 100 == 10)) return result;
		if (eventCard % 100 == 2) {
			if (CardUtil.cardNum(eventCard + 5, cardList) > 0) {
				result.add(eventCard);
				result.add(eventCard + 5);
			}else if (CardUtil.cardNum(eventCard + 8, cardList) > 0) {
				result.add(eventCard);
				result.add(eventCard + 8);
			}
		}else if (eventCard % 100 == 7) {
			if (CardUtil.cardNum(eventCard - 5, cardList) > 0) {
				result.add(eventCard);
				result.add(eventCard - 5);
			}else if (CardUtil.cardNum(eventCard + 3, cardList) > 0) {
				result.add(eventCard);
				result.add(eventCard + 3);
			}
		}else if (eventCard % 100 == 10) {
			if (CardUtil.cardNum(eventCard - 3, cardList) > 0) {
				result.add(eventCard);
				result.add(eventCard - 3);
			}else if (CardUtil.cardNum(eventCard - 8, cardList) > 0) {
				result.add(eventCard);
				result.add(eventCard - 8);
			}
		}
		
		return result;
	}
	

	static public int discardNum(List<Integer> cardList, HashSet<Integer> suoList) {
		int result = 0;
		for (Integer card : cardList) {
			if (suoList != null && suoList.contains(card)) {
				continue;
			}
			result++;
		}
		return result;
	}


	public static Set<Integer> getCardNumSet(List<Integer> cardList, int num) {
		Set<Integer> cardNum = new HashSet<>();
		Map<Integer, Integer> cardMap = Util.getCardNumMap(cardList);
		for (Entry<Integer, Integer> card : cardMap.entrySet()) {
			if (card.getValue() >= num) {
				cardNum.add(card.getKey());
			}
		}
		return cardNum;
	}


	static public int cardNum(int eventCard, List<Integer> cardList) {
		int result = 0;
		for (Integer card : cardList) {
			if (card == eventCard) {
				result += 1;
			}
		}
		return result;
	}

	static public int cardType(int card) {
		return card / 100;
	}

	static public boolean isRedCard(int card) {
		if (card == 0) {
			return true;
		}
		return card % 100 == 2 || card % 100 == 7 || card % 100 == 10;
	}

	static public Map<Integer, Integer> getCardNumMap(List<Integer> cardList) {
		Map<Integer, Integer> result = new HashMap<Integer, Integer>();
		for (Integer card : cardList) {
			if (!result.containsKey(card)) {
				result.put(card, 1);
			} else {
				int num = result.get(card);
				result.put(card, (num + 1));
			}
		}
		return result;
	}

	static public void removeCard(List<Integer> cardList, int card, int count) {
		int curCount = 0;
		for (int i = 0; i < cardList.size(); i++) {
			if (count == curCount) {
				return;
			}
			if (cardList.get(i) == card) {

				cardList.remove(i);
				i--;
				curCount++;
			}
		}
	}

	static public void removeGroup(List<int[]> group, int card) {
		for (int i = 0; i < group.size(); i++) {
			int[] cardArray = group.get(i);
			if (cardArray[0] == card) {
				group.remove(cardArray);
				return;
			}
		}
	}


	public static void distinctList(List<Integer> cardList) {
		Set<Integer> set = new HashSet<>(cardList);
		cardList.clear();
		cardList.addAll(set);
	}

	public static boolean isHeiHong(OpCard opCard) {
		int hei = 0, hong = 0;
		if (opCard != null) {
			if (opCard.card1 != 0) {
				if (isRedCard(opCard.card1)) {
					hong += 1;
				} else {
					hei += 1;
				}
			}
			if (opCard.card2 != 0) {
				if (isRedCard(opCard.card2)) {
					hong += 1;
				} else {
					hei += 1;
				}
			}
			if (opCard.card3 != 0) {
				if (isRedCard(opCard.card3)) {
					hong += 1;
				} else {
					hei += 1;
				}
			}
		}
		return hei > 0 && hong > 0;
	}

	public static <T> List<T> deepCopy(List<T> src) throws IOException, ClassNotFoundException {
		ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
		ObjectOutputStream out = new ObjectOutputStream(byteOut);
		out.writeObject(src);

		ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
		ObjectInputStream in = new ObjectInputStream(byteIn);
		@SuppressWarnings("unchecked")
		List<T> dest = (List<T>) in.readObject();
		return dest;
	}

	public static void removeOpCard(List<Integer> cardList, OpCard opcard) {
		if (opcard != null) {
			Util.checkCardAndRomve(opcard.card1, cardList, 1);
			Util.checkCardAndRomve(opcard.card2, cardList, 1);
			Util.checkCardAndRomve(opcard.card3, cardList, 1);
		}
	}

	public static boolean findOpCard(List<Integer> cardList, OpCard opcard) {
		boolean result = false;
		if (opcard != null) {
			int card1 = opcard.card1;
			int card2 = opcard.card2;
			int card3 = opcard.card3;
			List<Integer> list = new ArrayList<>();
			list.add(card1);
			list.add(card2);
			list.add(card3);
			Map<Integer, Integer> mapNum = Util.getCardNumMap(list);
			for (Entry<Integer, Integer> map : mapNum.entrySet()) {
				result = Util.checkCard(map.getKey(), cardList, map.getValue());
				if (!result) {
					break;
				}
			}
		}
		return result;
	}

	
	
	
	public static void main(String[] args) {
		List<Integer> cardList = new ArrayList<>();
		cardList.add(110);
		//cardList.add(103);
		/*cardList.add(105);
		cardList.add(104);
		cardList.add(107);
		cardList.add(110);
		cardList.add(108);
		cardList.add(210);
		cardList.add(202);
		cardList.add(209);
		cardList.add(205);
		cardList.add(205);
		cardList.add(206);
		cardList.add(204);
		cardList.add(203);
		cardList.add(203);*/
		List<Integer> seekAppropriate = seekAppropriate(108, cardList);
		//System.out.println(checkHongCard(202));
		//System.out.println(checkTuanYuan(cardList,));
		System.out.println(seekAppropriate.toString());
		/*String str="";
		for (Integer integer : cardList) {
			str+=integer+", ";
		}
		System.out.println(str);
		Set<Chi> chiSet = getCardChiGroup(cardList, 207);
		Set<Chi> canChiSet=new HashSet<>();
		canChiSet.addAll(chiSet);
		for (Chi chi : chiSet) {
			canChiSet.remove(chi);
			System.out.println(chi.toString());
		}
		System.out.println("--------------------------");
		for (Chi chi : canChiSet) {
			System.out.println(chi.toString());
		}*/
	}
}
