示例#1
0
        //判断出完这次牌后,下一次能不能一次出完
        private static bool afterThisOut_CanOutAllCard(List <Card> people, List <Card> thisCard)
        {
            //如果当前已经可以打完了,返回true
            if (people.Count == thisCard.Count)
            {
                return(true);
            }
            //保存当前的卡组
            List <Card> tDeck = Card.CopyListCard(people);

            //一出当前要出的牌
            for (int i = 0; i < thisCard.Count; i++)
            {
                tDeck.Remove(thisCard[i]);
            }

            //更新卡组的数量
            PeopleOperator.updateCardNum(tDeck);

            //判断下一次出牌
            //找同类型自己能出的最小的牌(不能随便拆)
            People p = new People();

            p.deck    = tDeck;
            p.htStyle = OutCardStyleEnum.CANT_OUT;
            //利用玩家的提示
            PlayerRemindCard.peopleFirstHint(p, false);

            //如果该玩家提示的牌可全部出完
            return(p.htCards.Count == tDeck.Count);
        }
示例#2
0
        //让后面的农民跑
        private static List <Card> letFarmerGo(List <Card>[] peoplesCard, int whoOut, int nowPerson, int whoCanOut)
        {
            List <Card> curOutCards = nextRemindCard[0];

            //如果是自己出牌(必须要出),想办法放农民跑
            if (whoOut == nowPerson)
            {
                OutCardStyle nextCardStyle = OutCardStyle.judgeCardStyle(nextRemindCard[whoCanOut]);

                //如果后面的农民出的是炸弹或者是四大天王,自己就随便出
                if (nextCardStyle.outCardStyleEnum == OutCardStyleEnum.BOMB ||
                    nextCardStyle.outCardStyleEnum == OutCardStyleEnum.FOUR_GHOST)
                {
                }
                //如果是单支或者是对子,拆任意牌,放农民走
                else if (nextCardStyle.outCardStyleEnum == OutCardStyleEnum.ONE ||
                         nextCardStyle.outCardStyleEnum == OutCardStyleEnum.TWO)
                {
                    List <Card> tempOutCards = new List <Card>();
                    switch (nextCardStyle.outCardStyleEnum)
                    {
                    case OutCardStyleEnum.ONE:
                        tempOutCards = CrushPreCard.findMinOneTwo(peoplesCard[nowPerson], 1);
                        break;

                    case OutCardStyleEnum.TWO:
                        tempOutCards = CrushPreCard.findMinOneTwo(peoplesCard[nowPerson], 2);
                        break;
                    }
                    if (tempOutCards.Count > 0 && tempOutCards[0].cardSize < nextCardStyle.firstCardSize)
                    {
                        curOutCards = tempOutCards;
                    }
                }
                //如果是其他类型的牌
                else
                {
                    //找同类型自己能出的最小的牌(可以拆)(利用玩家的提示)
                    People people = new People();
                    people.deck    = peoplesCard[nowPerson];
                    people.htStyle = nextCardStyle.outCardStyleEnum;
                    PlayerRemindCard.peopleFirstHint(people, true);

                    //判断当前出了以后,后面的农民能不能跑
                    OutCardStyle myCardOutStyle = OutCardStyle.judgeCardStyle(people.htCards);
                    //不能出证明放不了,就随便出
                    if (myCardOutStyle.outCardStyleEnum == nextCardStyle.outCardStyleEnum &&
                        myCardOutStyle.firstCardSize < nextCardStyle.firstCardSize)
                    {
                        curOutCards = people.htCards;
                    }
                }
            }
            //如果可以不出,则不出
            else
            {
                curOutCards.Clear();
            }
            return(curOutCards);
        }
示例#3
0
        //电脑想出什么牌就出什么牌
        private static List <Card> Robort_Free_Remind(List <Card> deck)
        {
            //找同类型自己能出的最小的牌(不能随便拆)
            People people = new People();

            people.deck    = deck;
            people.htStyle = OutCardStyleEnum.CANT_OUT;
            //利用玩家的提示
            PlayerRemindCard.peopleFirstHint(people, false);
            List <Card> resCards = people.htCards;

            //因为playerRemind提示后htStyle会到下一个,所以按照下一个处理
            switch (people.htStyle)
            {
            //如果提示出三带二,三不带,对子
            case OutCardStyleEnum.THREE:
                //如果带了对二及以上,只出三个头
                if (resCards[resCards.Count - 1].cardSize >= 15 && afterThisOut_CanOutAllCard(deck, resCards) == false)
                {
                    resCards.Clear();
                    //必须出牌,肯定还剩牌,找对子和单支
                    people.htStyle = OutCardStyleEnum.THREE;
                    PlayerRemindCard.peopleFirstHint(people, false);
                    resCards = people.htCards;
                }
                break;

            case OutCardStyleEnum.TWO:
            case OutCardStyleEnum.ONE:
                //不出3个2,不带对2,对小鬼,对老鬼//除非能直接出完或者出完这些牌可以一次性出完其他牌,否则不允许出
                if (resCards[0].cardSize >= 15 && afterThisOut_CanOutAllCard(deck, resCards) == false)
                {
                    resCards.Clear();
                    //必须出牌,肯定还剩牌,找对子和单支
                    people.htStyle = OutCardStyleEnum.TWO;
                    PlayerRemindCard.peopleFirstHint(people, false);
                    resCards = people.htCards;
                }
                break;
            }

            return(resCards);
        }