Beispiel #1
0
func TestTriangleRenderer(t *testing.T) {
	gnm := ga.NewGenomeInt(9 * 15)
	rst := graphics.CreateRaster(50, 10)

	tr := NewTriangleRenderer(gnm, rst)
	gnm.Randomize()
	tr.Render()
	//fmt.Println(tr.Raster)
	graphics.PrintRaster(tr.Raster)
}
Beispiel #2
0
func experiment(pipe chan string) {
	var generation [NG]*ga.GenomeInt
	for i := 0; i < NG; i++ {
		genome := ga.NewGenomeInt(5 * 9)
		genome.Randomize()
		generation[i] = genome
	}

	raster := graphics.CreateRaster(10, 10)
	renderer := app.NewTriangleRenderer(raster)

	for i := 0; i < NG; i++ {
		renderer.Render(generation[i])
		as := analytics.Asymmetry(raster)
		if as <= 1000 {
			pipe <- fmt.Sprintf("%d: as=%d\n", i, as)
			//fmt.Printf("%d: as=%d\n", i, as)
			//graphics.PrintRaster(raster)
		}
	}

	close(pipe)

}