Пример #1
0
func main() {

	fmt.Printf("Curent Path:[%s]\n\n", getCurrPath())

	filename := "./test_data.txt"
	ltrylst := new(ltry.LSetColor)

	checkBeg := 4000
	checkEnd := 10000
	var err error

	argNum := len(os.Args)
	if argNum >= 3 {
		checkBeg, err = strconv.Atoi(os.Args[1])
		if err != nil {
			fmt.Printf("para err arg1 [%s]\n", os.Args[1])
			return
		}
		checkEnd, err = strconv.Atoi(os.Args[2])
		if err != nil {
			fmt.Printf("para err arg2 [%s]\n", os.Args[2])
			return
		}
	}

	err = gethistoryfromfile(filename, ltrylst)
	if err != nil {
		fmt.Printf("[%s] read err[%s]\n", filename, err.Error())
	}

	sort.Sort(ltrylst)
	// ltrylst.Pt()

	// pValues := checkSets(ltrylst, ltrylst)
	// for k, v := range pValues {
	// 	fmt.Printf("idx:[%4d], Value:[%7d]\n", k, v-5000000)
	// }

	lt := new(ltry.LtryColor)
	lt.BeginSelf()
	totalCount := 0

	for i := 0; i < 100000000; i++ {
		pv := checkOneLt(lt, ltrylst)

		if pv <= checkEnd && pv >= checkBeg {
			fmt.Printf("%s, PV is [%d]\n", lt.Str(), pv)
			totalCount++
		}

		if !lt.AddSelf() {
			fmt.Printf("It's scaned all data already!!, Total Count [%d]\n", totalCount)
			return
		}
	}

	return

}