public static void checkAI(HashSet <AIInfo> aiInfos, int[] num, int jiang, int inputNum, AIProperty property)
        {
            bool huLian = property.huLian;
            int  N      = property.N;

            if (huLian)
            {
                for (int i = 0; i < N; i++)
                {
                    if (num[i] > 0 && i + 1 < N && num[i + 1] > 0 && i + 2 < N && num[i + 2] > 0)
                    {
                        num[i]--;
                        num[i + 1]--;
                        num[i + 2]--;
                        checkAI(aiInfos, num, jiang, inputNum, property);
                        num[i]++;
                        num[i + 1]++;
                        num[i + 2]++;
                    }
                }
            }

            for (int i = 0; i < N; i++)
            {
                if (num[i] >= 2 && jiang == -1)
                {
                    num[i] -= 2;
                    checkAI(aiInfos, num, i, inputNum, property);
                    num[i] += 2;
                }
            }

            for (int i = 0; i < N; i++)
            {
                if (num[i] >= 3)
                {
                    num[i] -= 3;
                    checkAI(aiInfos, num, jiang, inputNum, property);
                    num[i] += 3;
                }
            }

            for (int i = 0; i < N; i++)
            {
                if (num[i] != 0)
                {
                    return;
                }
            }

            AIInfo aiInfo = new AIInfo();

            aiInfo.inputNum = (int)inputNum;
            aiInfo.jiang    = (int)jiang;
            aiInfos.Add(aiInfo);
        }
Beispiel #2
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || GetType() != o.GetType())
            {
                return(false);
            }

            AIInfo huInfo = (AIInfo)o;

            if (inputNum != huInfo.inputNum)
            {
                return(false);
            }
            if (jiang != huInfo.jiang)
            {
                return(false);
            }
            return(true);
        }