Exemplo n.º 1
0
func main() {
	flag.Parse()

	if *cpuprof != "" {
		f, err := os.Create(*cpuprof)
		if err != nil {
			panic(err)
		}
		defer f.Close()
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	var w data.World
	w.Seed = *seed
	w.Init()

	for i := 0; i < *iterations; i++ {
		count := w.AreaCount
		for j := uint64(0); j < count; j++ {
			w.Area(j).Generate(&w)
		}
	}

	f, err := os.Create(fmt.Sprintf("seed_%d.html", *seed))
	if err != nil {
		panic(err)
	}
	defer f.Close()

	err = export.Export(f, &w)
	if err != nil {
		panic(err)
	}
}