Example #1
0
func newArena(brain1 *nn.Net, brain2 *nn.Net) *Arena {
	if brain1 == nil || brain2 == nil {
		fmt.Println("no brain in arena")
		return nil
	}
	conf := <-conf.Conf
	com1 := make(chan string)
	com2 := make(chan string)
	a := Arena{
		ais: [2]*ai.Ai{
			ai.New(conf.Depth, com1, conf.P1),
			ai.New(conf.Depth, com2, conf.P2),
		},
		com1: com1,
		com2: com2,
		p1:   conf.P1,
		p2:   conf.P2,
	}
	a.ais[0].SetHeur(brainHeur(brain1))
	go a.ais[0].Start()
	a.ais[1].SetHeur(brainHeur(brain2))
	go a.ais[1].Start()
	return &a
}
Example #2
0
func main() {
	comHud := make(chan string, 200)
	ai := ai.New(2, comHud)
	go ai.Start()
	game.Start(ai.ComIn, ai.ComOut, comHud)
}