예제 #1
0
 def test_init_multiple(self):
     """Define the arena with several agents"""
     arena = Arena([("Random A", lambda seed: AgentRandom(seed)),
                    ("Random C", lambda seed: AgentRandom(seed)),
                    ("Random B", lambda seed: AgentRandom(seed))], 5)
     results = arena.results()
     self.assertEqual(len(results), 3)
     self.assertListEqual(
         results, [['Random A', 0.4, 0.4, 0.4], ['Random C', 0.4, 0.4, 0.4],
                   ['Random B', 0.4, 0.4, 0.4]])
예제 #2
0
 def test_init_single(self):
     """Define the arena with one version"""
     arena = Arena([("Random", lambda seed: AgentRandom(seed))], 5)
     results = arena.results()
     self.assertEqual(len(results), 1)
     self.assertListEqual(results, [["Random", 0.4]])