Beispiel #1
0
    def agent_in_little_city(self, with_blue=False):
        red_agents = Composite("My reds")
        test_agent = create_resident(RED_AGENTS, TEST_ANUM)
        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_resident(BLUE_AGENTS, TEST_ANUM + 1)

        my_city = Env("Small city for test",
                      width=SMALL_GRID,
                      height=SMALL_GRID,
                      members=[red_agents, blue_agents])
        return (test_agent, my_city)
Beispiel #2
0
 def test_create_agent(self):
     """
     Test that creating an agent works.
     """
     fred = create_resident(RED_AGENTS, TEST_ANUM)
     freds_nm = group_names[RED_TEAM] + str(TEST_ANUM)
     self.assertEqual(freds_nm, str(fred))
Beispiel #3
0
 def test_other_group_index(self):
     red_agent = create_resident(RED_AGENTS, TEST_ANUM)
     self.assertEqual(BLUE_TEAM, other_group_index(red_agent))
     blue_agent = create_resident(BLUE_AGENTS, TEST_ANUM)
     self.assertEqual(RED_TEAM, other_group_index(blue_agent))