package fruits

import (
	"fmt"
	"testing"
)

func TestName(t *testing.T) {
	eleLineAppearRate := [][]int32{
		{926, 926, 556, 556, 741, 741, 741, 926, 1111, 1296, 1481},
		{926, 926, 556, 556, 741, 741, 741, 926, 1111, 1296, 1481},
		{926, 926, 556, 556, 741, 741, 741, 926, 1111, 1296, 1481},
		{926, 926, 556, 556, 741, 741, 741, 926, 1111, 1296, 1481},
		{926, 926, 556, 556, 741, 741, 741, 926, 1111, 1296, 1481},
		{926, 926, 556, 556, 741, 741, 741, 926, 1111, 1296, 1481},
	}
	//
	//fileName := fmt.Sprintf("classic888-%v-%d.csv", 0, 0)
	//file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm)
	//defer file.Close()
	//if err != nil {
	//	file, err = os.Create(fileName)
	//	if err != nil {
	//		return
	//	}
	//}
	//file.WriteString("随机倍率\n")
	//for i := 0; i < 100000; i++ {
	//	var wls WinResult
	//	wls.CreateLine(eleLineAppearRate)
	//	wls.Win()
	//	var rate int64
	//	for _, v := range wls.WinLine {
	//		rate += v.Rate
	//	}
	//	str := fmt.Sprintf("%v\r\n", rate)
	//	file.WriteString(str)
	//}

	var wls WinResult
	wls.CreateLine(eleLineAppearRate, false)
	//wls.EleValue[0] = Wild
	//wls.EleValue[1] = Scatter
	//wls.EleValue[2] = Bonus
	//wls.EleValue[3] = Bonus
	//wls.EleValue[4] = Bonus
	wls.EleValue = []int32{0, 0, 0, 0, 0, 9, 10, 9, 1, 8, 8, 9, 10, 6, 3}
	Print(wls.EleValue)
	wls.Win()
	fmt.Println(len(wls.WinLine))
	for _, wl := range wls.WinLine {
		flag := wl.Lines[0]
		var NowWildNum int
		var MaxLinXu int
		for _, n := range wl.Lines {
			if flag != n && flag == Wild {
				flag = n
			}
			if n == Wild {
				NowWildNum++
				if NowWildNum > MaxLinXu {
					MaxLinXu = NowWildNum
				}
			} else {
				NowWildNum = 0
			}
		}
		fmt.Println("MaxLinXu", MaxLinXu)
	}

}
