func LoadBucket(idx int, force bool) *Bucket { util.LoadFile(force) var balls []*Ball util.ForEachLine(func(line string, i int) { glog.Infof("处理第 %d 个\n", i) l := strings.Split(line, " ") idx, _ := strconv.Atoi(l[0]) r1, _ := strconv.Atoi(l[2]) r2, _ := strconv.Atoi(l[3]) r3, _ := strconv.Atoi(l[4]) r4, _ := strconv.Atoi(l[5]) r5, _ := strconv.Atoi(l[6]) r6, _ := strconv.Atoi(l[7]) b1, _ := strconv.Atoi(l[8]) ball := &Ball{ Date: l[1], Index: idx, Reds: util.SetBall([]int{r1, r2, r3, r4, r5, r6}), Blue: b1, } //ball.Hole = ball.maxHole() balls = append(balls, ball) return }) bkt := &Bucket{ Balls: balls, } return bkt }
func LoadBucket(idx int, force bool) *Bucket { util.LoadFile(force) var balls []*Ball unks := NewArea("6:5:6:5:6:5") ForEachLine(func(line string) { glog.Infof("处理第 %d 个\n", len(balls)) l := strings.Split(line, " ") idx, _ := strconv.Atoi(l[0]) r1, _ := strconv.Atoi(l[2]) r2, _ := strconv.Atoi(l[3]) r3, _ := strconv.Atoi(l[4]) r4, _ := strconv.Atoi(l[5]) r5, _ := strconv.Atoi(l[6]) r6, _ := strconv.Atoi(l[7]) b1, _ := strconv.Atoi(l[8]) ball := &Ball{ Date: l[1], Index: idx, Reds: []int{r1, r2, r3, r4, r5, r6}, Blue: b1, Policy: map[string]*Group{}, Composite: map[string]*Estimate{}, } sort.Ints(ball.Reds) //ball.Hole = ball.maxHole() balls = append(balls, ball) g33 := initGroup() add := func(g *Group) { // 在这儿计算group的EstimateKey ball.Policy[g.GroupKey()] = g g.AddEstimate(&balls) for _, rlist := range g.Parent.Pattern.Value { for _, r := range rlist { // 计算Pattern的预测 pdt := r.Predict[g.IndexInner] g.AddRankValue(&balls, pdt) } } //glog.Infoln("Group Test: ", " ",g) } ball.Policy[(*g33)[0].GroupKey()] = (*g33)[0] //NewSubGroups(g33,3, add) NewSubGroups(NewSubGroups(g33, 3, add), 2, add) ball.AddComposite(&balls, unks) return }) next := len(balls) if idx > 0 { next = idx } glog.Infoln("预测期数:", next, ":", len(balls)) return &Bucket{ Balls: balls, TargetIdx: next, } }