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); }
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(); }
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); }
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); }
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}"); }