def test_list(self): """Define the arena with one version""" arena = Arena([("Random A", lambda seed: AgentRandom(seed)), ("Random C", lambda seed: AgentRandom(seed)), ("Random B", lambda seed: AgentRandom(seed))], 5) self.assertEqual(len(arena.csv_results_lists()), 3) self.assertListEqual( arena.csv_results_lists(), [['Random A', 0.4, 0.4, 0.4], ['Random C', 0.4, 0.4, 0.4], ['Random B', 0.4, 0.4, 0.4]])
print('Starting arena') agents = [ # Place agents in this list as created # first in the tuple is the readable name # second is a lambda that ONLY takes a random seed. This can be discarded # if the the Agent does not require a seed ("Random", lambda seed: AgentRandom(seed)), ('Max', lambda seed: AgentMax(seed)), ('Exact', lambda seed: AgentExact(seed)), ('MinMax', lambda seed: AgentMinMax(seed, depth=3)) ] if AGENT_A3C is not None: agents.append(AGENT_A3C) ARENA = Arena(agents, 500) print('Run the arena for: ', ARENA.csv_header()) with open(ARGS.output, 'w') as f: WRITER = csv.writer(f) WRITER.writerow(ARENA.csv_header()) WRITER.writerows(ARENA.csv_results_lists()) print('Complete') # print(AgentRandom().move(4)) # Agent().move()