private void btCalc_Click(object sender, EventArgs e) { SimpleButton bt = (SimpleButton)sender; long ONE = 1; int redCount = 0; int num = Int32.Parse(bt.Text.Trim()); if (bt.Appearance.ForeColor == System.Drawing.Color.Silver) { bt.Appearance.ForeColor = System.Drawing.Color.Tomato; _calcRedmap |= ONE << (num - 1); } else { bt.Appearance.ForeColor = System.Drawing.Color.Silver; _calcRedmap &= ~(ONE << (num - 1)); } btCalcShow.Text = ""; for (int i = 0; i < 33; ++i) { if ((_calcRedmap & (ONE << i)) != 0) { redCount++; num = i + 1; btCalcShow.Text += string.Format("{0:00}", num); btCalcShow.Text += " "; } } btCalcShow.Refresh(); if (redCount == 6) { LottMin lt = new LottMin(_calcRedmap); string info = "sum=" + lt.sum.ToString(); info += " ac=" + lt.ac.ToString(); info += " sd=" + lt.sd.ToString(); btCalcAttr.Text = info; btCalcAttr.Refresh(); } else { btCalcAttr.Text = ""; } }
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(); }