func TestWithCoord(t *testing.T) { fmt.Println("Testing With Coord") agnt := make(chan link.Message, 10) prox := make(chan link.Message, 10) simple := NewSimple(1) proxy := cagent.NewAgentProxy(prox, agnt) go func() { agent.Run(simple, agnt, prox) }() co := coord.NewCoordinator() co.Configure( config.NewConfig( 0, []cagent.Agent{ proxy, }, "noise", true, true, geo.NewPoint(0, 0), geo.NewPoint(10, 10), ), ) co.Run() }
func RunAgentLocal(a agent.Agent, x, y, energy int) *AgentProxy { p2a := make(chan link.Message, 10) a2p := make(chan link.Message, 10) proxy := NewAgentProxy(p2a, a2p) proxy.SetState(cagent.NewAgentState(a.Id(), 0, *geo.NewPoint(x, y), Energy(energy))) go func() { agent.Run(a, a2p, p2a) }() return proxy }
func TestSimple(t *testing.T) { fmt.Println("Testing Simple Turn Rollover") agnt := make(chan link.Message, 10) prox := make(chan link.Message, 10) simple := NewSimple(1) proxy := cagent.NewAgentProxy(prox, agnt) go func() { agent.Run(simple, agnt, prox) }() if !proxy.Turn() { t.Error("Turn did not complete.") } }