コード例 #1
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);
        }
コード例 #2
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();
        }
コード例 #3
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}");
            }
        }