Example #1
0
 public static void GetTwoNearRepeat(int[,] redBall, int input, int i, ref int near, ref int repeat, ref int near_22, ref int repeat_22)
 {
     //int repeat0 = 0;
     if (MyTest.ISRepeat(redBall, input, i + 1) == 0)
     {
         if (MyTest.ISNear(redBall, input, i + 1) == 0)
         {
             if (MyTest.ISRepeat(redBall, input, i + 2) == 0)
             {
                 near_22 += MyTest.ISNear(redBall, input, i + 2);
             }
             else
             {
                 repeat_22 += MyTest.ISRepeat(redBall, input, i + 2);
             }
         }
         else
         {
             near += MyTest.ISNear(redBall, input, i + 1);
         }
     }
     else
     {
         repeat += MyTest.ISRepeat(redBall, input, i + 1);
     }
 }
Example #2
0
    private List <Exam_Mod> Exam_Analyze(int[,] redBall, int[,] miniRedBall, ArrayList arrRound)
    {
        //sum two prime near repeat
        //平均命中率
        //NormalDistribution nn = new NormalDistribution();
        int[]           countSum30 = new int[20];
        List <Exam_Mod> exModList  = new List <Exam_Mod>();

        for (int i = arrRound.Count - 2; i >= 1; i--)
        {
            Exam_Mod exMod = new Exam_Mod();

            exMod.Round = arrRound[i].ToString();
            int sum     = miniRedBall[0, i] + miniRedBall[1, i] + miniRedBall[2, i] + miniRedBall[3, i] + miniRedBall[4, i] + miniRedBall[5, i];
            int isPrime = MyTest.ISPrime(miniRedBall[0, i]) + MyTest.ISPrime(miniRedBall[1, i]) + MyTest.ISPrime(miniRedBall[2, i]) + MyTest.ISPrime(miniRedBall[3, i]) + MyTest.ISPrime(miniRedBall[4, i]) + MyTest.ISPrime(miniRedBall[5, i]);
            int isTwo   = MyTest.ISTwo(miniRedBall[0, i]) + MyTest.ISTwo(miniRedBall[1, i]) + MyTest.ISTwo(miniRedBall[2, i]) + MyTest.ISTwo(miniRedBall[3, i]) + MyTest.ISTwo(miniRedBall[4, i]) + MyTest.ISTwo(miniRedBall[5, i]);
            int near    = MyTest.ISNear(redBall, miniRedBall[0, i], i + 1) + MyTest.ISNear(redBall, miniRedBall[1, i], i + 1) + MyTest.ISNear(redBall, miniRedBall[2, i], i + 1) + MyTest.ISNear(redBall, miniRedBall[3, i], i + 1) + MyTest.ISNear(redBall, miniRedBall[4, i], i + 1) + MyTest.ISNear(redBall, miniRedBall[5, i], i + 1);
            int repeat  = MyTest.ISRepeat(redBall, miniRedBall[0, i], i + 1) + MyTest.ISRepeat(redBall, miniRedBall[1, i], i + 1) + MyTest.ISRepeat(redBall, miniRedBall[2, i], i + 1) + MyTest.ISRepeat(redBall, miniRedBall[3, i], i + 1) + MyTest.ISRepeat(redBall, miniRedBall[4, i], i + 1) + MyTest.ISRepeat(redBall, miniRedBall[5, i], i + 1);
            exMod.A0  = sum;
            exMod.A1  = repeat;
            exMod.A2  = near;
            exMod.A3  = near + repeat;
            exMod.A4  = isPrime;
            exMod.A5  = isTwo;
            exMod.A6  = miniRedBall[5, i] - miniRedBall[0, i];
            exMod.A7  = MyTest.FindUpNumber(i, miniRedBall[0, i] - 1, arrRound.Count - 1, redBall) + MyTest.FindUpNumber(i, miniRedBall[1, i] - 1, arrRound.Count - 1, redBall) + MyTest.FindUpNumber(i, miniRedBall[2, i] - 1, arrRound.Count - 1, redBall) + MyTest.FindUpNumber(i, miniRedBall[3, i] - 1, arrRound.Count - 1, redBall) + MyTest.FindUpNumber(i, miniRedBall[4, i] - 1, arrRound.Count - 1, redBall) + MyTest.FindUpNumber(i, miniRedBall[5, i] - 1, arrRound.Count - 1, redBall);
            exMod.A8  = near + repeat + isPrime + isTwo;
            exMod.B12 = miniRedBall[0, i] + "|" + miniRedBall[1, i] + "|" + miniRedBall[2, i] + "|" + miniRedBall[3, i] + "|" + miniRedBall[4, i] + "|" + miniRedBall[5, i];
            exMod.B13 = repeat + "|" + near + "|" + isPrime + "|" + isTwo;

            string hope = MyTest.Belong(miniRedBall, i, 1);

            exMod.B14 = hope.Split('_')[0];
            exMod.B15 = hope.Split('_')[1];

            hope = MyTest.Belong(miniRedBall, i, 2);

            exMod.B16 = hope.Split('_')[0];
            exMod.B17 = hope.Split('_')[1];

            hope = MyTest.Belong(miniRedBall, i, 3);

            exMod.B18 = hope.Split('_')[0];
            exMod.B19 = hope.Split('_')[1];
            int   sum30     = 0;
            int[] miniSum30 = new int[6];
            int   min30     = 0;
            int   max30     = 0;

            if (i + 30 <= arrRound.Count - 1)
            {
                for (int x = 0; x < 6; x++)
                {
                    for (int j = 0; j < 30; j++)
                    {
                        sum30        += redBall[miniRedBall[x, i] - 1, i + j + 1];
                        miniSum30[x] += redBall[miniRedBall[x, i] - 1, i + j + 1];
                    }
                    if (min30 == 0)
                    {
                        min30 = miniSum30[x];
                    }

                    if (min30 > miniSum30[x])
                    {
                        min30 = miniSum30[x];
                    }
                    if (max30 < miniSum30[x])
                    {
                        max30 = miniSum30[x];
                    }


                    //newRow["a2" + x.ToString()] = miniSum30[x];
                    countSum30[miniSum30[x]]++;
                }

                string strC = "";
                for (int x = 0; x < 6; x++)
                {
                    if (miniSum30[x] >= 9)
                    {
                        exMod.B26 = "A" + exMod.B26;
                    }
                    else if (miniSum30[x] >= 3)
                    {
                        exMod.B26 += "B";
                    }
                    else
                    {
                        strC += "C";
                    }
                }
                exMod.B26 += strC;
            }
            exMod.B27 = NewNumber.GetTwoNearRepeatRound(redBall, miniRedBall[0, i], miniRedBall[1, i], miniRedBall[2, i], miniRedBall[3, i], miniRedBall[4, i], miniRedBall[5, i], i);

            int[] sub = new int[7];
            sub[0] = miniRedBall[0, i];
            sub[1] = miniRedBall[1, i] - miniRedBall[0, i] - 1;
            sub[2] = miniRedBall[2, i] - miniRedBall[1, i] - 1;
            sub[3] = miniRedBall[3, i] - miniRedBall[2, i] - 1;
            sub[4] = miniRedBall[4, i] - miniRedBall[3, i] - 1;
            sub[5] = miniRedBall[5, i] - miniRedBall[4, i] - 1;
            sub[6] = 34 - miniRedBall[5, i];
            // string strSub = sub[0].ToString() + "-" + sub[1].ToString() + "-" + sub[2].ToString() + "-" + sub[3].ToString() + "-" + sub[4].ToString() + "-" + sub[5].ToString();// +"-" + sub[6].ToString();//无用
            string strSubSub = MyTest.GetSubStr(sub);
            exMod.B28 = strSubSub;

            ArrayList al = new ArrayList();
            al.Add(MyTest.FindUpNumber(i, miniRedBall[0, i] - 1, arrRound.Count - 1, redBall));
            al.Add(MyTest.FindUpNumber(i, miniRedBall[1, i] - 1, arrRound.Count - 1, redBall));
            al.Add(MyTest.FindUpNumber(i, miniRedBall[2, i] - 1, arrRound.Count - 1, redBall));
            al.Add(MyTest.FindUpNumber(i, miniRedBall[3, i] - 1, arrRound.Count - 1, redBall));
            al.Add(MyTest.FindUpNumber(i, miniRedBall[4, i] - 1, arrRound.Count - 1, redBall));
            al.Add(MyTest.FindUpNumber(i, miniRedBall[5, i] - 1, arrRound.Count - 1, redBall));
            exMod.B29 = al[0].ToString() + "|" + al[1].ToString() + "|" + al[2].ToString() + "|" + al[3].ToString() + "|" + al[4].ToString() + "|" + al[5].ToString();
            al.Sort();

            exMod.A9  = sum30;
            exMod.A10 = int.Parse(al[0].ToString());
            exMod.A11 = int.Parse(al[5].ToString());
            //for (int j = 0; j < al.Count; j++)
            //{
            //    newRow["a12"] += int.Parse(al[j].ToString()).ToString("00") + " ";
            //}
            exMod.Flag = Define._AnalyzeFlag;//999999

            //Exam_Bll.InsertExamMod(exMod);
            exModList.Add(exMod);

            //_DT.Rows.Add(newRow);

            //newRow = _DT.NewRow();
            //newRow["round"] = arrRound[i].ToString();

            //int[] lastNum = new int[10];
            //int oneNumSum = 0;
            //int lastNumSum = 0;
            //int mathSum = 0;
            //string strOne = "";
            //int max = miniRedBall[0, i];
            //int maxBegin = 0;
            //int maxEnd = miniRedBall[0, i];
            //if (miniRedBall[1, i] - miniRedBall[0, i] > max)
            //{
            //    max = miniRedBall[1, i] - miniRedBall[0, i];
            //    maxBegin = miniRedBall[0, i];
            //    maxEnd = miniRedBall[1, i];
            //}
            //if (miniRedBall[2, i] - miniRedBall[1, i] > max)
            //{
            //    max = miniRedBall[2, i] - miniRedBall[1, i];
            //    maxBegin = miniRedBall[1, i];
            //    maxEnd = miniRedBall[2, i];
            //}
            //if (miniRedBall[3, i] - miniRedBall[2, i] > max)
            //{
            //    max = miniRedBall[3, i] - miniRedBall[2, i];
            //    maxBegin = miniRedBall[2, i];
            //    maxEnd = miniRedBall[3, i];
            //}
            //if (miniRedBall[4, i] - miniRedBall[3, i] > max)
            //{
            //    max = miniRedBall[4, i] - miniRedBall[3, i];
            //    maxBegin = miniRedBall[3, i];
            //    maxEnd = miniRedBall[4, i];
            //}
            //if (miniRedBall[5, i] - miniRedBall[4, i] > max)
            //{
            //    max = miniRedBall[5, i] - miniRedBall[4, i];
            //    maxBegin = miniRedBall[4, i];
            //    maxEnd = miniRedBall[5, i];
            //}
            //if (34 - miniRedBall[5, i] > max)
            //{
            //    max = 34 - miniRedBall[5, i];
            //    maxBegin = miniRedBall[5, i];
            //    maxEnd = 34;
            //}
            //newRow["a12"] = max.ToString("00");
            //newRow["a13"] = maxBegin;
            //newRow["a14"] = maxEnd;
            //newRow["a15"] = miniRedBall[0, i];
            //newRow["a16"] = miniRedBall[5, i];

            //List<double> dd = new List<double>();
            //dd.Add(Convert.ToDouble(miniRedBall[0, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[1, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[2, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[3, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[4, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[5, i]));
            //double ddd = nn.stdev(dd);
            //double aaa = nn.average(dd);
            //newRow["a20"] = ddd.ToString("0.0");
            //newRow["a21"] = aaa.ToString("0.0");
            //dd = new List<double>();
            //dd.Add(Convert.ToDouble(miniRedBall[0, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[1, i] - miniRedBall[0, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[2, i] - miniRedBall[1, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[3, i] - miniRedBall[2, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[4, i] - miniRedBall[3, i]));
            //dd.Add(Convert.ToDouble(miniRedBall[5, i] - miniRedBall[4, i]));
            //dd.Add(Convert.ToDouble(33 - miniRedBall[5, i]));
            //ddd = nn.stdev(dd);
            //aaa = nn.average(dd);
            //newRow["a22"] = ddd.ToString("0.0");

            //al = new ArrayList();
            //al.Add(miniRedBall[0, i]);
            //al.Add(miniRedBall[1, i] - miniRedBall[0, i]);
            //al.Add(miniRedBall[2, i] - miniRedBall[1, i]);
            //al.Add(miniRedBall[3, i] - miniRedBall[2, i]);
            //al.Add(miniRedBall[4, i] - miniRedBall[3, i]);
            //al.Add(miniRedBall[5, i] - miniRedBall[4, i]);
            //al.Add(33-miniRedBall[5, i]);
            //for (int x = 0; x < al.Count; x++)
            //{
            //    newRow["a17"] += al[x].ToString() + "|";
            //}
            //al.Sort();
            //for (int x = 0; x < al.Count; x++)
            //{
            //    newRow["a18"] = al[x].ToString() + "|" + newRow["a18"];
            //}
            //for (int x = 0; x < 6; x++)
            //{
            //    mathSum += Math.Abs(miniRedBall[x, i] - miniRedBall[x, i + 1]);
            //    newRow["a" + x.ToString()] = Math.Abs(miniRedBall[x, i] - miniRedBall[x, i + 1]);
            //    if (miniRedBall[x, i] < 10)
            //    {
            //        newRow["a23"] += miniRedBall[x, i].ToString("00") + "|";
            //        strOne += "0";
            //        lastNumSum += miniRedBall[x, i];
            //        //newRow["a2" + x.ToString()] = miniRedBall[x, i];
            //        lastNum[miniRedBall[x, i]]++;
            //    }
            //    else
            //    {
            //        if (miniRedBall[x, i] < 20)
            //        {
            //            newRow["a24"] += miniRedBall[x, i].ToString("00") + "|";
            //        }
            //        else if (miniRedBall[x, i] < 30)
            //        {
            //            newRow["a25"] += miniRedBall[x, i].ToString("00") + "|";
            //        }
            //        string begin = miniRedBall[x, i].ToString().Substring(0, 1);
            //        strOne += begin;
            //        oneNumSum += int.Parse(begin);
            //        string end = miniRedBall[x, i].ToString().Substring(1, 1);
            //        //newRow["a2" + x.ToString()] = end;
            //        lastNumSum += int.Parse(end);
            //        lastNum[int.Parse(end)]++;
            //    }
            //}

            //newRow["a6"] = mathSum;
            //newRow["a10"] = min30;
            //newRow["a11"] = max30;
            //newRow["a27"] = lastNumSum;
            //newRow["a28"] = strOne;
            //newRow["a29"] = oneNumSum;
            //newRow["a19"] = sum;
            //newRow["a30"] = miniRedBall[0, i] + "|" + miniRedBall[1, i] + "|" + miniRedBall[2, i] + "|" + miniRedBall[3, i] + "|" + miniRedBall[4, i] + "|" + miniRedBall[5, i];

            //for (int x = 0; x < 10; x++)
            //{
            //    if (lastNum[x] != 0)
            //        for (int y = 0; y < lastNum[x]; y++)
            //        {
            //            newRow["a26"] += x.ToString();
            //        }
            //}

            //newRow["FLAG"] = Define._AnalyzeTwoFlag;//99999900
            //_DT.Rows.Add(newRow);
        }
        return(exModList);
    }
Example #3
0
    public static string GetCircle(int ii, string input, ref DataTable dt, int[,] redBall, ArrayList arrRound, ArrayList alSum)
    {
        string  returnStr = "";
        DataRow newRow;

        string[] str = input.Split('|');

        int a1 = int.Parse(str[0]);
        int a2 = int.Parse(str[1]);
        int a3 = int.Parse(str[2]);
        int a4 = int.Parse(str[3]);
        int a5 = int.Parse(str[4]);
        int a6 = int.Parse(str[5]);

        int[] aa = new int[6];
        //int max = 0;
        alSum.Add(a1 + a2 + a3 + a4 + a5 + a6);

        for (int i = 0; i < aa.Length; i++)
        {
            if (i == 0)
            {
                aa[i] = int.Parse(str[i]) - 1 + 33 - int.Parse(str[5]);
                //max = aa[i];
            }
            else
            {
                aa[i] = int.Parse(str[i]) - int.Parse(str[i - 1]) - 1;
                //if (max < aa[i])
                // max = aa[i];
            }
        }


        newRow         = dt.NewRow();
        newRow["FLAG"] = 778888555;

        newRow["A2"]  = int.Parse(str[5]) - int.Parse(str[0]);
        newRow["A12"] = input;
        newRow["A13"] = aa[0].ToString() + "_" + aa[1].ToString() + "_" + aa[2].ToString() + "_" + aa[3].ToString() + "_" + aa[4].ToString() + "_" + aa[5].ToString();
        //string strNew = "";
        //bool change = false;
        //for (int i = 0; i < aa.Length; i++)
        //{
        //    if (max == aa[i] || change)
        //    {
        //        newRow["A14"] += aa[i].ToString("00");
        //        if (max == aa[i])
        //            change = true;
        //    }
        //    else
        //    {
        //        strNew += aa[i].ToString("00");
        //    }
        //}
        string strCircle = GetOneCircle(a1, a2, a3, a4, a5, a6, redBall);

        newRow["A14"] = strCircle.Split('|')[0];
        newRow["A15"] = strCircle.Split('|')[1];

        ArrayList al = new ArrayList();

        al.Add(a1 - 1 + 33 - a6);
        al.Add(a2 - a1 - 1);
        al.Add(a3 - a2 - 1);
        al.Add(a4 - a3 - 1);
        al.Add(a5 - a4 - 1);
        al.Add(a6 - a5 - 1);
        al.Sort();
        newRow["A16"] = al[0].ToString() + "_" + al[1].ToString() + "_" + al[2].ToString() + "_" + al[3].ToString() + "_" + al[4].ToString() + "_" + al[5].ToString();
        newRow["A17"] = al[0].ToString() + "_" + al[1].ToString() + "_" + al[2].ToString() + "_" + al[3].ToString() + "_" + al[4].ToString();
        newRow["A18"] = al[0].ToString() + "_" + al[1].ToString() + "_" + al[2].ToString() + "_" + al[3].ToString();
        newRow["A19"] = al[0].ToString() + "_" + al[1].ToString() + "_" + al[2].ToString();

        int near   = MyTest.ISNear(redBall, a1, ii + 1) + MyTest.ISNear(redBall, a2, ii + 1) + MyTest.ISNear(redBall, a3, ii + 1) + MyTest.ISNear(redBall, a4, ii + 1) + MyTest.ISNear(redBall, a5, ii + 1) + MyTest.ISNear(redBall, a6, ii + 1);
        int repeat = MyTest.ISRepeat(redBall, a1, ii + 1) + MyTest.ISRepeat(redBall, a2, ii + 1) + MyTest.ISRepeat(redBall, a3, ii + 1) + MyTest.ISRepeat(redBall, a4, ii + 1) + MyTest.ISRepeat(redBall, a5, ii + 1) + MyTest.ISRepeat(redBall, a6, ii + 1);

        if (alSum.Count >= 7)
        {
            returnStr += "|" + alSum[alSum.Count - 1].ToString();
            int row = 19;
            NormalDistribution nn = new NormalDistribution();
            List <double>      dd = new List <double>();
            dd.Add(Convert.ToDouble(alSum[alSum.Count - 2].ToString()));
            for (int i = 0; i < 5; i++)
            {
                dd.Add(Convert.ToDouble(alSum[alSum.Count - i - 3].ToString()));
                double ddd = nn.stdev(dd);
                double avg = nn.average(dd);
                newRow["A" + (row + i * 2 + 1).ToString()] = ddd;
                newRow["A" + (row + i * 2 + 2).ToString()] = avg;

                returnStr += "|" + ddd.ToString() + "|" + avg.ToString();
            }
        }

        newRow["A3"]    = near;
        newRow["A4"]    = repeat;
        newRow["A5"]    = a1 + a2 + a3 + a4 + a5 + a6;
        newRow["A6"]    = (a1 + a2 + a3 + a4 + a5 + a6) / 10;
        newRow["round"] = arrRound[ii].ToString();
        dt.Rows.Add(newRow);

        return(returnStr);
    }