示例#1
0
        public static void CombinePreList(List <Card> preList, int iNum, DeleCardList deleCardList = null)
        {
            List <Card> retList  = new List <Card>();
            List <Card> poolList = CardList.GetAllCardList();

            for (int i = 0; i < 1; i++)
            {
                if (preList == null)
                {
                    break;
                }
                if (preList.Count == 0)
                {
                    break;
                }
                foreach (var card in preList)
                {
                    Debug.Assert(poolList.Contains(card));
                    poolList.Remove(card);
                    retList.Add(card);
                }
            }

            Combination(poolList, 2, retList, deleCardList);
        }
示例#2
0
        public static void Combination(List <Card> poolList, int iNum, List <Card> retList = null, DeleCardList deleCardList = null)
        {
            Debug.Assert(iNum > 0);
            Debug.Assert(poolList.Count >= iNum);

            if (retList == null)
            {
                retList = new List <Card>();
            }

            if (iNum == 1)
            {
                foreach (var item in poolList)
                {
                    retList.Add(item);
                    if (deleCardList != null)
                    {
                        deleCardList.Invoke(retList);
                        //GetHandResult(retList);
                    }
                    retList.Remove(item);
                }
                return;
            }

            List <Card> next_poolList = new List <Card>();

            foreach (var item in poolList)
            {
                next_poolList.Add(item);
            }
            for (int i = 0; i < poolList.Count - 1; i++)
            {
                if (next_poolList.Count < iNum)
                {
                    return;
                }
                var item = poolList[i];
                retList.Add(item);
                next_poolList.Remove(item);

                Combination(next_poolList, iNum - 1, retList, deleCardList);

                retList.Remove(item);
            }
        }
示例#3
0
        public static void CombineAllCard(int iNum, DeleCardList deleCardList = null)
        {
            List <Card> allCardList = CardList.GetAllCardList();

            Combination(allCardList, 2, null, deleCardList);
        }