Example #1
0
        public static List <NumberModel5> DongtaiRule(NumberModel5 last)
        {
            List <NumberModel5> allnumber = NumberModel5.GetAllNumer();
            List <NumberModel5> resnumber = new List <NumberModel5>();

            List <int> list = new List <int>();

            list.Add(last.N1);
            list.Add(last.N2);
            list.Add(last.N3);
            list.Add(last.N4);
            list.Add(last.N5);

            foreach (var item in allnumber)
            {
                if (list.Contains(item.N1) || list.Contains(item.N2) || list.Contains(item.N3) || list.Contains(item.N4) || list.Contains(item.N5))
                {
                    resnumber.Add(item);
                }
            }


            return(resnumber);
        }
Example #2
0
        public static void huice2()
        {
            Console.WriteLine("开始回测:");


            decimal leijiamount = 0;     //盈利
            decimal kuisun      = 0;     //亏损
            decimal cost        = 0;     //花费
            decimal sing        = 95000; //奖金

            int zhongjian次数 = 0;
            int buzhong次数   = 0;


            string    sql = "select * from tb_hiscode";
            DataTable dt  = SQLiteHelper.ExecuteDataset(sql).Tables[0];


            //上一期
            NumberModel5 first = null;
            //下一期
            NumberModel5 next = null;
            //循环游标
            int index = 0;

            foreach (DataRow dr in dt.Rows)
            {
                if (index == 0)
                {
                    index = 1;
                    first = new NumberModel5()
                    {
                        N1 = Convert.ToInt32(dr["N1"]), N2 = Convert.ToInt32(dr["N2"]), N3 = Convert.ToInt32(dr["N3"]), N4 = Convert.ToInt32(dr["N4"]), N5 = Convert.ToInt32(dr["N5"])
                    };
                    continue;
                }
                next = new NumberModel5()
                {
                    N1 = Convert.ToInt32(dr["N1"]), N2 = Convert.ToInt32(dr["N2"]), N3 = Convert.ToInt32(dr["N3"]), N4 = Convert.ToInt32(dr["N4"]), N5 = Convert.ToInt32(dr["N5"])
                };

                int nextno = int.Parse(dr["issno"].ToString()) + 1;

                //if (nextno==19338)
                //{
                //    break;
                //}
                //if (nextno==19005)
                //{
                //    Console.WriteLine("19005");
                //}
                //string sql2 = "select * from tb_hiscode where issno=" + nextno;
                //DataRow row = SQLiteHelper.ExecuteDataRow(sql2);

                //本期开奖号码
                //NumberModel5 benqimodel5= new NumberModel5() { N1 = Convert.ToInt32(dr["N1"]), N2 = Convert.ToInt32(dr["N2"]), N3 = Convert.ToInt32(dr["N3"]), N4 = Convert.ToInt32(dr["N4"]), N5 = Convert.ToInt32(dr["N5"]) };
                //根据本期号码推测出来的下棋号码
                List <NumberModel5> yucemodel5list = DongtaiRule(first);
                //开奖结果
                //NumberModel5 kaijiangmodel5 = new NumberModel5() { N1=Convert.ToInt32( row["N1"]), N2 = Convert.ToInt32(row["N2"]), N3 = Convert.ToInt32(row["N3"]), N4 = Convert.ToInt32(row["N4"]), N5= Convert.ToInt32(row["N5"])};


                bool flag = false;
                foreach (var item in yucemodel5list)
                {
                    if (NumberModel5.Same(item, next))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    decimal yingli = sing - yucemodel5list.Count;
                    leijiamount             = leijiamount + yingli;
                    zhongjian次数             = zhongjian次数 + 1;
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(dr["issno"] + " 期【" + dr["code"] + "】:中奖了!,成本:" + yucemodel5list.Count + "元,奖金:" + sing + " 元, 盈利:" + yingli + " 元,累计盈利:" + leijiamount);
                }
                else
                {
                    buzhong次数               = buzhong次数 + 1;
                    leijiamount             = leijiamount - yucemodel5list.Count;
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(dr["issno"] + "期【" + dr["code"] + "】:没中奖!, 成本:" + yucemodel5list.Count + "元,奖金:0 元, 亏损:" + yucemodel5list.Count + " 元,累计盈利:" + leijiamount);
                }

                index++;
                first = new NumberModel5()
                {
                    N1 = next.N1, N2 = next.N2, N3 = next.N3, N4 = next.N4, N5 = next.N5
                };
            }
        }