Exemplo n.º 1
0
 def test_other_group_index(self):
     red_agent = create_agent(TEST_ANUM,
                              DEF_TOLERANCE, DEF_SIGMA,
                              color=RED_TEAM)
     self.assertEqual(BLUE_TEAM, other_group_index(red_agent))
     blue_agent = create_agent(TEST_ANUM,
                               DEF_TOLERANCE, DEF_SIGMA,
                               color=BLUE_TEAM)
     self.assertEqual(RED_TEAM, other_group_index(blue_agent))
Exemplo n.º 2
0
    def agent_in_little_city(self, with_blue=False):
        red_agents = Composite("My reds")
        test_agent = create_agent(TEST_ANUM, color=RED_TEAM)
        red_agents += test_agent
        blue_agents = Composite("My blues")
        if with_blue:
            for i in range(0, SMALL_GRID * SMALL_GRID - 1):
                blue_agents += create_agent(TEST_ANUM + 1, color=BLUE_TEAM)

        my_city = Env("Small city for test",
                      width=SMALL_GRID,
                      height=SMALL_GRID,
                      members=[red_agents, blue_agents])
        return (test_agent, my_city)
Exemplo n.º 3
0
 def test_create_agent(self):
     """
     Test that creating an agent works.
     """
     fred = create_agent(TEST_ANUM,
                         DEF_TOLERANCE, DEF_SIGMA,
                         color=RED_TEAM) 
     freds_nm = group_names[RED_TEAM] + str(TEST_ANUM)
     self.assertEqual(freds_nm, str(fred))
Exemplo n.º 4
0
 def test_create_agent(self):
     fred = create_agent(TEST_ANUM, color=RED_TEAM)
     freds_nm = group_names[RED_TEAM] + str(TEST_ANUM)
     self.assertEqual(freds_nm, str(fred))
Exemplo n.º 5
0
 def test_my_group_index(self):
     red_agent = create_agent(TEST_ANUM, color=RED_TEAM)
     self.assertEqual(RED_TEAM, my_group_index(red_agent))
     blue_agent = create_agent(TEST_ANUM, color=BLUE_TEAM)
     self.assertEqual(BLUE_TEAM, my_group_index(blue_agent))
Exemplo n.º 6
0
 def test_agent_action(self):
     fred = create_agent(TEST_ANUM, color=RED)
     ret = agent_action(fred)
     self.assertEqual(ret, False)