コード例 #1
0
        public void Generate() //close #1
        {
            Random run    = new Random();
            int    number = run.Next();

            NewNumber?.Invoke(number);
        }
コード例 #2
0
ファイル: Numbertron.cs プロジェクト: AnnaChursina/HomeWork3
        //New Number событие

        public void Generate()
        {
            Random figure = new Random();
            var    i      = figure.Next(0, 500);

            NewNumber?.Invoke(this, new ForEvent(i));
        }
コード例 #3
0
    private ArrayList GetSixGoalRound(ArrayList arrRound, int[,] miniRedBall, int[,] redBall)
    {
        ArrayList al = new ArrayList();


        for (int i = arrRound.Count - 1; i > 0; i--)
        {
            int near      = 0;
            int repeat    = 0;
            int near_22   = 0;
            int repeat_22 = 0;
            if (i != arrRound.Count - 2)
            {
                for (int j = 0; j < miniRedBall.GetLength(0); j++)
                {
                    NewNumber.GetTwoNearRepeat(redBall, miniRedBall[j, i], i, ref near, ref repeat, ref near_22, ref repeat_22);
                }

                if (near + repeat + near_22 + repeat_22 == 6)
                {
                    al.Add(i);
                }
            }
        }


        return(al);
    }
コード例 #4
0
ファイル: BigNumber.aspx.cs プロジェクト: rnnny/rnnny-web
    private void SpssToFile(string now, int select, string input, string color, StreamWriter sw)
    {
        string[] str = input.Split(' ');

        for (int i = 0; i < str.Length - select; i++)
        {
            int    sumAll  = 0;
            string strFile = "";
            for (int j = 0; j < select; j++)
            {
                if (j <= 1)
                {
                    sumAll = int.Parse(str[j + i].ToString());
                }
                else
                {
                    sumAll += int.Parse(str[j + i].ToString());
                }
                if (j == 0)
                {
                    if (i == 0)
                    {
                        MyGoal.InnerHtml += NewNumber.DisplayStr(now + " ", color);
                    }
                    else
                    {
                        strFile += now + " ";
                    }
                }
                if (i == 0)
                {
                    MyGoal.InnerHtml += NewNumber.DisplayStr(sumAll + " ", color);
                }
                else
                {
                    strFile += sumAll + " ";
                }
            }
            if (i == 0)
            {
                MyGoal.InnerHtml += NewNumber.DisplayBROne();
            }
            else
            {
                //开始写入
                sw.WriteLine(strFile);
            }
        }
    }
コード例 #5
0
    private void DisplaySelect(int select, int upDown, string input)
    {
        haha.InnerHtml += "Select= " + select.ToString() + " " + _ArrRound[select].ToString() + " " + input + "<input id='checkSelect' type='checkbox' />";
        haha.InnerHtml += NewNumber.DisplayBR();
        //string color = "red";
        for (int i = select + upDown; i > select - upDown; i--)
        {
            if (i == select)
            {
                haha.InnerHtml += "<div title='" + Convert.ToString(i) + "' style='cursor:hand;color:brown;float:left;font-weight:bold; width: 100px; height: 20px;border-style:groove;border-color:red'>" + _ArrRound[i].ToString() + "</div>";
            }
            else
            {
                if (i > 0)
                {
                    haha.InnerHtml += "<div title='" + Convert.ToString(i) + "' style='cursor:hand;color:brown;float:left; width: 100px; height: 20px;border-style:groove;border-color:red'>" + _ArrRound[i].ToString() + "</div>";
                }
                else
                {
                    haha.InnerHtml += "<div title='" + Convert.ToString(i) + "' style='cursor:hand;color:brown;float:left; width: 100px; height: 20px;border-style:groove;border-color:red'>" + i.ToString() + "</div>";
                }
            }
            for (int j = 0; j < 33; j++)
            {
                if (i > select)
                {
                    if (_RedBall[j, i] == 0)
                    {
                        haha.InnerHtml += "<div title='" + Convert.ToString(j) + "' style='cursor:hand;color:black;float:left; width: 20px; height: 20px;border-style:groove;border-color:red'>00</div>";
                    }
                    else
                    {
                        haha.InnerHtml += "<div title='" + Convert.ToString(j) + "' style='cursor:hand;color:red;float:left;font-weight:bold; width: 20px; height: 20px;background-color:yellow;border-style:groove;border-color:red'>" + (j + 1).ToString("00") + "</div>";
                    }
                }
                else
                {
                    if (i > 1)
                    {
                        if (_RedBall[j, i] == 0)
                        {
                            haha.InnerHtml += "<div id='select" + _IDCount.ToString() + Convert.ToString(i) + Convert.ToString(j + 1) + "' title='" + Convert.ToString(j) + "'onclick=SelectClick(id) style='cursor:hand;color:black;float:left; width: 20px; height: 20px;border-style:groove;border-color:red'>00</div>";
                        }
                        else
                        {
                            haha.InnerHtml += "<div id='select" + _IDCount.ToString() + Convert.ToString(i) + Convert.ToString(j + 1) + "' title='ok'onclick=SelectClick(id) style='cursor:hand;color:black;float:left; width: 20px; height: 20px;border-style:groove;border-color:red'>00</div>";
                        }
                    }
                    else
                    {
                        if (i == 1)
                        {
                            if (_RedBall[j, i] == 0)
                            {
                                haha.InnerHtml += "<div title='" + Convert.ToString(j) + "' style='cursor:hand;color:black;float:left; width: 20px; height: 20px;border-style:groove;border-color:red'>00</div>";
                            }
                            else
                            {
                                haha.InnerHtml += "<div title='" + Convert.ToString(j) + "' style='cursor:hand;color:red;float:left;font-weight:bold; width: 20px; height: 20px;background-color:yellow;border-style:groove;border-color:red'>" + (j + 1).ToString("00") + "</div>";
                            }
                        }
                        else if (i == 0)
                        {
                            if (input.Contains((j + 1).ToString("00")))
                            {
                                haha.InnerHtml += "<div id='select" + _IDCount.ToString() + Convert.ToString(i) + Convert.ToString(j + 1) + "' title='ok'onclick=SelectClick(id) style='cursor:hand;color:red;float:left;font-weight:bold;width:20px;height:20px;background-color:yellow;border-style:groove;border-color:blue'>" + (j + 1).ToString("00") + "</div>";
                            }
                            else
                            {
                                haha.InnerHtml += "<div id='select" + _IDCount.ToString() + Convert.ToString(i) + Convert.ToString(j + 1) + "' title='" + Convert.ToString(j) + "'onclick=SelectClick(id) style='cursor:hand;color:black;float:left; width: 20px; height: 20px;border-style:groove;border-color:red'>00</div>";
                            }
                        }
                        else
                        {
                            haha.InnerHtml += "<div id='select" + _IDCount.ToString() + Convert.ToString(i) + Convert.ToString(j + 1) + "' title='" + Convert.ToString(j) + "'onclick=SelectClick(id) style='cursor:hand;color:black;float:left; width: 20px; height: 20px;border-style:groove;border-color:red'>00</div>";
                        }
                    }
                }
            }

            haha.InnerHtml += NewNumber.DisplayBR();
        }
    }
コード例 #6
0
ファイル: BigNumber.aspx.cs プロジェクト: rnnny/rnnny-web
    //#region Display
    //private string DisplayOverLineStr(string input, string color)
    //{
    //    if (_Print)
    //        return "<span style='text-decoration:overline;color:" + color + "'>" + input + "</span>";
    //    else
    //        return string.Empty;
    //}

    //private string DisplayStr(string input, string color)
    //{
    //    if (_Print)
    //        return "<span style='color:" + color + "'>" + input + "</span>";
    //    else
    //        return string.Empty;
    //}

    //private string DisplayStrWidthBold(string input, string color)
    //{
    //    if (_Print)
    //        return "<span style='display:-moz-inline-box; display:inline-block; width:20px;font-weight: bold;color:" + color + "'>" + input + "</span>";
    //    else
    //        return string.Empty;
    //}

    //private string DisplayStrWidth(string input, string color)
    //{
    //    if (_Print)
    //        return "<span style='display:-moz-inline-box; display:inline-block; width:20px;color:" + color + "'>" + input + "</span>";
    //    else
    //        return string.Empty;
    //}

    //private string DisplayStr(string input, string color, int number)
    //{
    //    if (_Print)
    //        return "<span title=" + number.ToString() + " style='cursor:pointer;color:" + color + "'>" + input + "</span>";
    //    else
    //        return string.Empty;

    //}

    //private string DisplayBR()
    //{
    //    if (_Print)
    //        return "<br><br>";
    //    else
    //        return string.Empty;
    //}
    //private string DisplayBROne()
    //{
    //    if (_Print)
    //        return "<br>";
    //    else
    //        return string.Empty;
    //}
    //#endregion

    #region TwoNearRepeat
    private void TwoNearRepeat(ArrayList arrRound, int[,] miniRedBall, int[,] redBall)
    {
        MyGoal.InnerHtml = NewNumber.TwoNearRepeat(arrRound, miniRedBall, redBall, ref _DT);
    }
コード例 #7
0
ファイル: BigNumber.aspx.cs プロジェクト: rnnny/rnnny-web
    protected void Page_Load(object sender, EventArgs e)
    {
        _DT = CreateTable();

        GameOver = 1;//模拟结果为1,计算结果为2,

        int maxCount = 10000;

        MyTest.ReadFile(_ArrRound, _ArrGoal, _RedBall, _MiniRedBall, _OneBall, _TwoBall, maxCount, "big");

        if (GameOver == 2)
        {
            //_HangZhou.Data = 121;
            //_HangZhou.Data1 = 0;
            //_HangZhou.Data2 = 4;//down
            //_HangZhou.Data3 = 15;
            //_HangZhou.Data33 = "";

            //_HangZhou.Two = -1;
            //_HangZhou.Prime = 1;
            //_HangZhou.NearRepeat = 3;

            //_HangZhou.Mini0 = 5;//up
            //_HangZhou.Mini1 = 5;//down
            //_HangZhou.Mini2 = 35;//up
            //_HangZhou.Mini3 = 23;//up
            //_HangZhou.Mini4 = 20;//up
            //_HangZhou.Mini5 = -1;//up

            int a1 = _MiniRedBall[0, 1];
            int a2 = _MiniRedBall[1, 1];
            int a3 = _MiniRedBall[2, 1];
            int a4 = _MiniRedBall[3, 1];
            int a5 = _MiniRedBall[4, 1];

            int a21 = _MiniRedBall[0, 2];
            int a22 = _MiniRedBall[1, 2];
            int a23 = _MiniRedBall[2, 2];
            int a24 = _MiniRedBall[3, 2];
            int a25 = _MiniRedBall[4, 2];
            //int a6 = _TwoBall[1];

            int sum  = 0;//= a1 + a2 + a3 + a4 + a5;
            int upup = 0;
            for (int j = 0; j < 5; j++)
            {
                sum  += _MiniRedBall[j, 1];
                upup += MyTest.FindUpNumber(1, _MiniRedBall[j, 1] - 1, _ArrRound.Count - 1, _RedBall);
            }

            int count = 0;
            if (_HangZhou.Data33.Contains(a1.ToString("00")))
            {
                count++;
            }
            if (_HangZhou.Data33.Contains(a2.ToString("00")))
            {
                count++;
            }
            if (_HangZhou.Data33.Contains(a3.ToString("00")))
            {
                count++;
            }
            if (_HangZhou.Data33.Contains(a4.ToString("00")))
            {
                count++;
            }
            if (_HangZhou.Data33.Contains(a5.ToString("00")))
            {
                count++;
            }

            //_Print = true;

            int isPrime      = MyTest.ISPrime(a1) + MyTest.ISPrime(a2) + MyTest.ISPrime(a3) + MyTest.ISPrime(a4) + MyTest.ISPrime(a5);
            int isTwo        = MyTest.ISTwo(a1) + MyTest.ISTwo(a2) + MyTest.ISTwo(a3) + MyTest.ISTwo(a4) + MyTest.ISTwo(a5);
            int isNearRepeat = MyTest.ISNearRepeat(_RedBall, a1, GameOver) + MyTest.ISNearRepeat(_RedBall, a2, GameOver) + MyTest.ISNearRepeat(_RedBall, a3, GameOver) + MyTest.ISNearRepeat(_RedBall, a4, GameOver) + MyTest.ISNearRepeat(_RedBall, a5, GameOver);


            MyGoal.InnerHtml += NewNumber.DisplayStr("00--" + _ArrRound[1].ToString() + " --#" + sum.ToString() + "_" + _HangZhou.Sum + "|" + (a5 - a1).ToString() + "_" + _HangZhou.LeftRight + "|" + _OneBall[1].ToString() + "_" + _HangZhou.BlueBall + "_" + _OneBall[2].ToString() + "|" + upup.ToString() + "_" + _HangZhou.UpUp + "|" + count.ToString() + "|" + a1.ToString() + "_" + _HangZhou.Mini0 + "_" + a21.ToString() + "|" + a2.ToString() + "_" + _HangZhou.Mini1 + "_" + a22.ToString() + "|" + a3.ToString() + "_" + _HangZhou.Mini2 + "_" + a23.ToString() + "|" + a4.ToString() + "_" + _HangZhou.Mini3 + "_" + a24.ToString() + "|" + a5.ToString() + "_" + _HangZhou.Mini4 + "_" + a25.ToString() + "|" + _TwoBall[1].ToString() + "_" + _HangZhou.Mini5 + "_" + _TwoBall[2].ToString() + "|" + isTwo.ToString() + "_" + _HangZhou.Two + "|" + isPrime.ToString() + "_" + _HangZhou.Prime + "|" + isNearRepeat.ToString() + "_" + _HangZhou.NearRepeat, "green");
        }

        if (GameOver == 1)
        {
            //_DT = CreateTable();

            string dataBase = "";

            //string dataBase = "Test";

            //int maxCount = 1000;
            //string dataBase = "TestNew";


            //_Data = true;
            //Combination(_Data);

            #region ForSpssModeler
            dataBase = "TestNew";
            _Data    = false;
            //_Print = true;
            CreateSpssModelerData(_ArrRound, _MiniRedBall, _RedBall, _OneBall, _TwoBall);
            #endregion

            #region TwoNearRepeat
            //777788
            dataBase = "TestNew";
            _Data    = true;
            //_Print = true;
            TwoNearRepeat(_ArrRound, _MiniRedBall, _RedBall);
            #endregion


            if (_Data)
            {
                System.Data.SqlClient.SqlBulkCopy bcp = new System.Data.SqlClient.SqlBulkCopy("Data Source = .; Initial Catalog = " + dataBase + "; User Id = sa; Password = suyu57501;");
                bcp.DestinationTableName = "dbo.TestOutput";
                bcp.WriteToServer(_DT);
            }
        }
    }
コード例 #8
0
ファイル: BigNumber.aspx.cs プロジェクト: rnnny/rnnny-web
    private void CreateSpssModelerData(ArrayList arrRound, int[,] miniRedBall, int[,] redBall, int[] oneBall, int[] twoBall)
    {
        int[] sum        = new int[arrRound.Count];
        int[] leftRight  = new int[arrRound.Count];
        int[] upup       = new int[arrRound.Count];
        int[] mini0      = new int[arrRound.Count];
        int[] mini1      = new int[arrRound.Count];
        int[] mini2      = new int[arrRound.Count];
        int[] mini3      = new int[arrRound.Count];
        int[] mini4      = new int[arrRound.Count];
        int[] mini5      = new int[arrRound.Count];
        int[] two        = new int[arrRound.Count];
        int[] prime      = new int[arrRound.Count];
        int[] nearRepeat = new int[arrRound.Count];

        for (int i = 1; i < arrRound.Count; i++)
        {
            MyGoal.InnerHtml += NewNumber.DisplayStr(arrRound[i].ToString() + " || ", "brown");
            for (int j = 0; j < 5; j++)
            {
                sum[i]           += miniRedBall[j, i];
                MyGoal.InnerHtml += NewNumber.DisplayStr(miniRedBall[j, i].ToString("00") + " ", "red");
                upup[i]          += MyTest.FindUpNumber(i, miniRedBall[j, i] - 1, arrRound.Count - 1, redBall);
                two[i]           += MyTest.ISTwo(miniRedBall[j, i]);
                prime[i]         += MyTest.ISPrime(miniRedBall[j, i]);
                nearRepeat[i]    += MyTest.ISNearRepeat(redBall, miniRedBall[j, i], i + 1);
            }
            leftRight[i]      = miniRedBall[4, i] - miniRedBall[0, i];
            MyGoal.InnerHtml += NewNumber.DisplayStr("--" + sum[i] + " || " + leftRight[i], "blue");
            MyGoal.InnerHtml += NewNumber.DisplayBR();

            mini0[i] = miniRedBall[0, i];
            mini1[i] = miniRedBall[1, i];
            mini2[i] = miniRedBall[2, i];
            mini3[i] = miniRedBall[3, i];
            mini4[i] = miniRedBall[4, i];
            mini5[i] = twoBall[i];
        }

        int select = 40;

        string       strPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
        FileStream   fs      = new FileStream(strPath + "\\spss\\data33\\33.txt", FileMode.Create);
        StreamWriter sw      = new StreamWriter(fs);

        for (int i = 0; i < 35; i++)
        {
            int    j   = 0;
            string str = "";
            while (j <= arrRound.Count - 1)
            {
                int ii = MyTest.FindUpNumber(j, i, arrRound.Count - 1, redBall);
                j   += ii + 1;
                str += ii.ToString() + " ";
            }
            if (i % 2 == 0)
            {
                SpssToFile((i + 1).ToString(), select, str.Substring(0, str.Length - 1), "blue", sw);
            }
            else
            {
                SpssToFile((i + 1).ToString(), select, str.Substring(0, str.Length - 1), "green", sw);
            }
        }

        //清空缓冲区
        sw.Flush();
        //关闭流
        sw.Close();
        fs.Close();

        select = 20;


        DisplaySpss(arrRound, select, mini0, "mini\\miniNew0.txt");
        DisplaySpss(arrRound, select, mini1, "mini\\miniNew1.txt");
        DisplaySpss(arrRound, select, mini2, "mini\\miniNew2.txt");
        DisplaySpss(arrRound, select, mini3, "mini\\miniNEw3.txt");
        DisplaySpss(arrRound, select, mini4, "mini\\miniNew4.txt");
        DisplaySpss(arrRound, select, mini5, "mini\\miniNew5.txt");
        DisplaySpss(arrRound, select, sum, "data0123\\dataNew.txt");
        DisplaySpss(arrRound, select, leftRight, "data0123\\dataNew1.txt");
        DisplaySpss(arrRound, select, oneBall, "data0123\\dataNew2.txt");
        DisplaySpss(arrRound, select, upup, "data0123\\dataNew3.txt");
        DisplaySpss(arrRound, select, two, "data0123\\two.txt");
        DisplaySpss(arrRound, select, prime, "data0123\\prime.txt");
        DisplaySpss(arrRound, select, nearRepeat, "data0123\\nearRepeat.txt");
    }
コード例 #9
0
ファイル: Numbertron.cs プロジェクト: vinaris/HomeWork3
        public void Generate()
        {
            int number = rnd.Next();

            NewNumber?.Invoke(number);
        }
コード例 #10
0
ファイル: exam.aspx.cs プロジェクト: rnnny/rnnny-web
    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);
    }
コード例 #11
0
    //private static bool FindFromArrayList(string[] str, ArrayList al)
    //{
    //    bool find = true;

    //    for (int i = 0; i < al.Count; i++ )
    //    {
    //        int count = 0;
    //        for (int j = 0; j < str.Length; j++)
    //        {
    //            if (!al[i].ToString().Contains(str[j]))
    //            {
    //                find = false; break;
    //            }
    //            else
    //                count++;
    //        }
    //        if (count == 4)
    //        {
    //            find = true;
    //            break;
    //        }
    //    }

    //    if (al.Count == 0)
    //        find = false;
    //    return find;
    //}

    public static ArrayList MyFourToSix(string[] inputAll, int max, ref DataTable dt, int[,] redBall, string six)
    {
        DataRow   newRow;
        ArrayList al = new ArrayList();

        string[] input = new string[inputAll.Length];
        int[]    num   = new int[inputAll.Length];
        for (int i = 0; i < input.Length; i++)
        {
            string[] str = inputAll[i].Split('#');

            num[i] = int.Parse(str[0]);

            input[i] = str[1];
        }

        for (int i = 0; i < input.Length; i++)
        {
            if (input[i] != "")
            {
                string[] strI = input[i].Split('|');
                //if (FindFromArrayList(strI, al))
                //{
                //    input[i] = "";
                //}
                //else
                //{
                //bool select = false;
                for (int j = i + 1; j < input.Length; j++)
                {
                    if (input[j] != "")
                    {
                        string[] strJ = input[j].Split('|');
                        //if (FindFromArrayList(strJ, al))
                        //{
                        //    input[j] = "";
                        //}
                        //else
                        //{
                        int count = 0;
                        for (int x = 0; x < strI.Length; x++)
                        {
                            if (input[j].Contains(strI[x]))
                            {
                                count++;
                            }
                            if (count > 2)
                            {
                                break;
                            }
                        }

                        if (count == 2)
                        {
                            //string[] str = al[i].ToString().Split('_');
                            string[] str0 = input[i].Split('|');
                            string[] str1 = input[j].Split('|');

                            ArrayList alNew = new ArrayList();

                            for (int x = 0; x < str0.Length; x++)
                            {
                                if (!alNew.Contains(str0[x]))
                                {
                                    alNew.Add(str0[x]);
                                }
                                if (!alNew.Contains(str1[x]))
                                {
                                    alNew.Add(str1[x]);
                                }
                            }

                            int countAl = 0;
                            for (int x = 0; x < al.Count; x++)
                            {
                                countAl = 0;
                                for (int y = 0; y < alNew.Count; y++)
                                {
                                    if (al[x].ToString().Split('%')[0].Contains(alNew[y].ToString()))
                                    {
                                        countAl++;
                                    }

                                    if (countAl > 3)
                                    {
                                        break;
                                    }
                                }
                                if (countAl > 3)
                                {
                                    break;
                                }
                            }
                            if (countAl <= 3)
                            {
                                alNew.Sort();
                                string strSix = "";
                                for (int x = 0; x < alNew.Count; x++)
                                {
                                    if (x == alNew.Count - 1)
                                    {
                                        strSix += alNew[x].ToString();
                                    }
                                    else
                                    {
                                        strSix += alNew[x].ToString() + "|";
                                    }
                                }

                                //al[i] = al[i].ToString() ;
                                if (six.Contains(strSix))
                                {
                                    string[] str6 = strSix.Split('|');

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

                                    //if ((a2 - a1 == 1 || a3 - a2 == 1 || a4 - a3 == 1 || a5 - a4 == 1 || a6 - a5 == 1) && (ISRepeat(redBall, a1, 1) == 1 || ISRepeat(redBall, a2, 1) == 1 || ISRepeat(redBall, a3, 1) == 1 || ISRepeat(redBall, a4, 1) == 1 || ISRepeat(redBall, a5, 1) == 1 || ISRepeat(redBall, a6, 1) == 1))
                                    if ((a2 - a1 == 1 || a3 - a2 == 1 || a4 - a3 == 1 || a5 - a4 == 1 || a6 - a5 == 1) || (ISRepeat(redBall, a1, 1) == 1 || ISRepeat(redBall, a2, 1) == 1 || ISRepeat(redBall, a3, 1) == 1 || ISRepeat(redBall, a4, 1) == 1 || ISRepeat(redBall, a5, 1) == 1 || ISRepeat(redBall, a6, 1) == 1))
                                    {
                                        al.Add(input[i] + "_" + input[j] + "=" + strSix + "%" + (num[i] + num[j]).ToString());

                                        newRow         = dt.NewRow();
                                        newRow["FLAG"] = 778877;
                                        newRow["A1"]   = num[i] + num[j];
                                        newRow["A12"]  = strSix;
                                        newRow["A15"]  = NewNumber.GetTwoNearRepeatRound(redBall, a1, a2, a3, a4, a5, a6, 0);
                                        newRow["A13"]  = a1 + a2 + a3 + a4 + a5 + a6;
                                        newRow["A14"]  = a6 - a1;
                                        dt.Rows.Add(newRow);

                                        input[i] = "";
                                        input[j] = "";

                                        //select = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    //if (!select)
                    //{
                    //    newRow = dt.NewRow();
                    //    newRow["FLAG"] = 77887788;
                    //    newRow["A1"] = num[i];
                    //    newRow["A12"] = input[i];

                    //    dt.Rows.Add(newRow);
                    //}
                }
            }
        }


        return(al);
    }