コード例 #1
0
ファイル: Filter.cs プロジェクト: cnzoupeng/NewLt
        public int get_6_to_5(long map, List <long> allItem)
        {
            Combin     cb      = new Combin(6, 5);
            long       ONE     = 1;
            List <int> listRed = new List <int>();

            for (int i = 0; i < 33; ++i)
            {
                if ((map & (ONE << i)) != 0)
                {
                    listRed.Add(i + 1);
                }
            }

            long mapTmp = cb.next();

            while (mapTmp != 0)
            {
                map = map_to_33map(mapTmp, 6, listRed);
                allItem.Add(map);
                mapTmp = cb.next();
            }

            return(0);
        }
コード例 #2
0
ファイル: ToolTab.cs プロジェクト: cnzoupeng/NewLt
        public void build_all_census()
        {
            LottMin ltt;
            Combin  cbm     = new Combin(33, 6);
            long    itemMap = cbm.next();

            while (itemMap != 0)
            {
                ltt = new LottMin(itemMap);
                _countSum.add(ltt.sum);
                _countAc.add(ltt.ac);
                _countSd.add(ltt.sd);
                itemMap = cbm.next();
            }

            foreach (LottoryItem item in gridList)
            {
                _countHisSum.add(item.sum_red);
                _countHisSd.add(item.sd);
                _countHisAc.add(item.ac);
            }

            _countSum.buildCensus();
            _countAc.buildCensus();
            _countSd.buildCensus();

            _countHisSum.min = _countSum.min;
            _countHisSum.add(_countSum.max);
            _countHisSum.list[_countSum.max]--;

            _countHisAc.min = _countAc.min;
            _countHisAc.add(10);
            _countHisAc.list[10]--;

            _countHisSd.min = _countSd.min;
            _countHisSd.add(27);
            _countHisSd.list[27]--;

            _countHisSum.buildCensus();
            _countHisAc.buildCensus();
            _countHisSd.buildCensus();
        }
コード例 #3
0
ファイル: Distrib.cs プロジェクト: cnzoupeng/NewLt
        public DistData(LottoryItem item)
        {
            id   = item.id;
            miss = item.miss_row;
            num  = string.Format("{0:00} {1:00} {2:00} {3:00} {4:00} {5:00} {6:00}"
                                 , item.red[0], item.red[1], item.red[2], item.red[3], item.red[4], item.red[5], item.blue);


            long Fix = 0x3F;

            for (int i = 0; i < 5; ++i)
            {
                long mapTmp = item.map & (Fix << (i * 6));
                distr *= 10;
                distr += Combin.bit_count(mapTmp);
            }

            distr *= 10;
            distr += Combin.bit_count(item.map & 0x1C0000000);
        }
コード例 #4
0
ファイル: Filter.cs プロジェクト: cnzoupeng/NewLt
        public int getItem(string reds, List <long> allItem)
        {
            int pos = reds.IndexOf("(");

            if (pos > 0)
            {
                return(-1);
            }
            if (pos == 0)
            {
                return(get_comb(reds, allItem));
            }

            string[]   redAll  = reds.Split(' ');
            List <int> redList = new List <int>();

            foreach (string item in redAll)
            {
                int red = Int32.Parse(item);
                if (red > 33 || red < 1)
                {
                    return(-1);
                }
                redList.Add(red);
            }

            if (redList.Count < 6)
            {
                return(-1);
            }
            Combin cb  = new Combin(redList.Count, 6);
            long   map = cb.next();

            while (map != 0)
            {
                allItem.Add(map_to_33map(map, redList.Count, redList));
                map = cb.next();
            }

            return(0);
        }
コード例 #5
0
ファイル: ToolTab.cs プロジェクト: cnzoupeng/NewLt
        private void btCalcCombin_Click(object sender, EventArgs e)
        {
            if (Combin.bit_count(_calcRedmap) != 2)
            {
                return;
            }

            long ONE = 1;
            int  m   = 0;
            int  n   = 0;

            for (int i = 0; i < 33; ++i)
            {
                if ((_calcRedmap & (ONE << i)) != 0)
                {
                    if (m == 0)
                    {
                        m = i + 1;
                    }
                    else
                    {
                        n = i + 1;
                        break;
                    }
                }
            }

            int tmp = 0;

            if (m < n)
            {
                tmp = n;
                n   = m;
                m   = tmp;
            }
            Combin cb = new Combin(m, n);

            btCalcAttr.Text = cb.COUNT.ToString();
            btCalcAttr.Refresh();
        }
コード例 #6
0
ファイル: Filter.cs プロジェクト: cnzoupeng/NewLt
        public int get_comb(string reds, List <long> allItem)
        {
            long mapFix = 0;
            long map    = 0;
            long ONE    = 1;

            int fixCount   = 0;
            int unfixCount = 0;

            int posStop = reds.IndexOf(")");

            if (posStop < 0)
            {
                return(-1);
            }

            //get map fix
            string fixRed = reds.Substring(1, posStop - 1);

            fixRed = fixRed.Trim();
            string[] fixReds = fixRed.Split(' ');
            if (fixReds.Length > 5)
            {
                return(-1);
            }

            foreach (string item in fixReds)
            {
                int red = Int32.Parse(item);
                if (red > 33 || red < 1)
                {
                    return(-1);
                }
                mapFix |= ONE << (red - 1);
                fixCount++;
            }

            //get map unfix
            string unfix = reds.Substring(posStop + 1);

            unfix = unfix.Trim();
            string[] unfixs = unfix.Split(' ');
            if (unfixs.Length < 1)
            {
                return(-1);
            }

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

            foreach (string unitem in unfixs)
            {
                int red = Int32.Parse(unitem);
                if (red > 33 || red < 1)
                {
                    return(-1);
                }
                unfixReds.Add(red);
                unfixCount++;
            }

            int    combCount = 6 - fixCount;
            Combin cb        = new Combin(unfixCount, combCount);
            long   mapTmp    = cb.next();

            while (mapTmp != 0)
            {
                map = mapFix | map_to_33map(mapTmp, unfixCount, unfixReds);
                allItem.Add(map);
                mapTmp = cb.next();
            }

            return(0);
        }
コード例 #7
0
ファイル: ToolTab.cs プロジェクト: cnzoupeng/NewLt
        private void btFindExist_Click(object sender, EventArgs e)
        {
            string numFind = numToFindExist.Text.Trim();

            if (numFind.Length < 2)
            {
                return;
            }

            long ONE      = 1;
            long mapFind  = 0;
            int  redCount = 0;

            int[]    red  = { 0, 0, 0, 0, 0, 0 };
            string[] nums = numFind.Split(' ');
            for (int i = 0; i < 6 && i < nums.Length; ++i)
            {
                red[i] = Int32.Parse(nums[i]);
                if (red[i] < 1 || red[i] > 33)
                {
                    return;
                }
                mapFind |= ONE << (red[i] - 1);
                redCount++;
            }

            //----------------------------------------------
            if (comBoxExistData.SelectedIndex == 0)
            {
                if (gridList.Count < 1)
                {
                    return;
                }

                int[] countIndex = { 0, 0, 0, 0, 0, 0, 0 };
                gridFindExist.DataSource = listFindExist;
                listFindExist.Clear();

                foreach (LottoryItem item in gridList)
                {
                    long tmpMap = mapFind & item.map;
                    tmpMap &= 0x1FFFFFFFF;
                    int same = Combin.bit_count(tmpMap);
                    countIndex[same]++;
                    string numStr = string.Format("{0:00} {1:00} {2:00} {3:00} {4:00} {5:00} {6:00}"
                                                  , item.red[0], item.red[1], item.red[2], item.red[3], item.red[4], item.red[5], item.blue);
                    CountExist countex = new CountExist(item.id, numStr, same);
                    listFindExist.Add(countex);
                }

                for (int i = 0; i < 7; ++i)
                {
                    CountExist countex = new CountExist(i, countIndex[i].ToString(), 10 + i);
                    listFindExist.Add(countex);
                }

                gridViewFindExist.SortInfo.Add(gridViewFindExist.Columns[2], ColumnSortOrder.Descending);
                gridViewFindExist.Focus();
                SendKeys.SendWait("^{HOME}");
            }
            else if (comBoxExistData.SelectedIndex == 1)
            {
                if (listLtTaobao.Count < 1)
                {
                    return;
                }

                int         matchCount = 0;
                LtCounter   count      = new LtCounter();
                List <long> allRed     = new List <long>();
                List <long> red5s      = new List <long>();
                int[]       countIndex = { 0, 0, 0, 0, 0, 0, 0 };
                gridFindExist.DataSource = listFindExist;
                listFindExist.Clear();

                foreach (LtItem item in listLtTaobao)
                {
                    matchCount = 0;
                    if (count.getItem(item.red, allRed) == 0)
                    {
                        foreach (long map in allRed)
                        {
                            int mcount = Combin.bit_count(map & mapFind);
                            if (mcount > matchCount)
                            {
                                matchCount = mcount;
                            }

                            red5s.Clear();
                            long mapTmp = map & 0x1FFFFFFFF;
                            if (!mapTaob6.ContainsKey(mapTmp))
                            {
                                mapTaob6.Add(mapTmp, null);
                            }

                            count.get_6_to_5(mapTmp, red5s);
                            for (int i = 0; i < 6; ++i)
                            {
                                if (!mapTaob5.ContainsKey(red5s[i]))
                                {
                                    mapTaob5.Add(red5s[i], null);
                                }
                            }
                        }
                        countIndex[matchCount]++;
                        CountExist countex = new CountExist(item.user, item.red, matchCount);
                        listFindExist.Add(countex);
                    }
                    allRed.Clear();
                }

                for (int i = 0; i < 7; ++i)
                {
                    CountExist countex = new CountExist(i, countIndex[i].ToString(), 10 + i);
                    listFindExist.Add(countex);
                }

                gridViewFindExist.SortInfo.Add(gridViewFindExist.Columns[2], ColumnSortOrder.Descending);
                gridViewFindExist.Focus();
                SendKeys.SendWait("^{HOME}");
            }
        }
コード例 #8
0
ファイル: ToolTab.cs プロジェクト: cnzoupeng/NewLt
        private void btDoFileter_Click(object sender, EventArgs e)
        {
            int    randIndex = 0;
            string err       = "";

            btDoFileter.Enabled = false;

            if (!parseFiltOpt(ref err))
            {
                MessageBox.Show(err);
                btDoFileter.Enabled = true;
                return;
            }

            listFilAll.Clear();

            Combin cmb      = new Combin(33, 6);
            long   curMap   = cmb.next();
            int    allIndex = 0;

            int showStep = 5000;
            int prgsStep = (int)cmb.COUNT / showStep;

            progressFilter.Properties.Minimum = 0;
            progressFilter.Properties.Maximum = prgsStep;
            progressFilter.Properties.Step    = 1;
            progressFilter.Position           = 0;
            progressFilter.Refresh();

            LtCounter   count      = new LtCounter();
            List <long> allRed     = new List <long>();
            List <long> red5s      = new List <long>();
            bool        matchOther = false;

            int  his_fil_count = 0;
            int  tao_fil_count = 0;
            long mapExist      = 0;

            int[] redAllCount = new int[36];
            for (int i = 0; i < 36; i++)
            {
                redAllCount[i] = 0;
            }

            while (curMap != 0)
            {
                matchOther = false;
                TinyLott lott = new TinyLott(curMap);
                if (!isMatch(lott))
                {
                    goto FindNext;
                }

                //过滤历史
                red5s.Clear();
                if (his_filter_count > 0)
                {
                    if (his_filter_count == 5)
                    {
                        count.get_6_to_5(curMap, red5s);
                        for (int i = 0; i < 6; ++i)
                        {
                            if (mapHis5.ContainsKey(red5s[i]))
                            {
                                his_fil_count++;
                                goto FindNext;
                            }
                        }
                    }
                    if (his_filter_count == 6 && mapHis6.ContainsKey(curMap))
                    {
                        his_fil_count++;
                        goto FindNext;
                    }
                }

                //过滤淘宝
                if (tao_filter_count > 0)
                {
                    if (tao_filter_count == 5)
                    {
                        count.get_6_to_5(curMap, red5s);
                        for (int i = 0; i < 6; ++i)
                        {
                            if (mapTaob5.ContainsKey(red5s[i]))
                            {
                                tao_fil_count++;
                                goto FindNext;
                            }
                        }
                    }
                    if (tao_filter_count == 6 && mapTaob6.ContainsKey(curMap))
                    {
                        tao_fil_count++;
                        goto FindNext;
                    }
                }

                mapExist |= lott.map;
                listFilAll.Add(lott);
                if (listFilAll.Count % 10 == 0)
                {
                    labelFilterOut.Text = "   " + lott.toString() + "   ";
                    labelFilterOut.Refresh();
                }

                for (int i = 0; i < 6; ++i)
                {
                    redAllCount[lott.red[i]]++;
                }

FindNext:
                curMap = cmb.next();

                allIndex++;
                if (allIndex % showStep == 0)
                {
                    progressFilter.PerformStep();
                    progressFilter.Refresh();
                    //gridBand2.Caption = "  找到 " + listFilAll.Count.ToString() + " 个号码";
                    bt_showcount.Text = listFilAll.Count.ToString();
                    bt_showcount.Refresh();
                    gridFilter.Refresh();
                }
            }

            if (listFilAll.Count > 0)
            {
                randIndex           = random.Next(0, listFilAll.Count);
                labelFilterOut.Text = "   " + listFilAll[randIndex].toString() + "   ";
            }

            bt_showcount.Text = listFilAll.Count.ToString();
            bt_showcount.Refresh();
            progressFilter.Properties.Step = prgsStep;
            progressFilter.Refresh();
            btDoFileter.Enabled = true;


            //-----------------------------------
            gridFindExist.DataSource = listFindExist;
            listFindExist.Clear();
            for (int i = 1; i < 34; ++i)
            {
                CountExist countex = new CountExist(i, " ", redAllCount[i]);
                listFindExist.Add(countex);
            }
            gridViewFindExist.SortInfo.Add(gridViewFindExist.Columns[2], ColumnSortOrder.Descending);
            gridViewFindExist.Focus();
            SendKeys.SendWait("^{HOME}");
        }