def test_map_creation(self): input_file_name = './sample_map1.txt' with open(input_file_name) as f: input_lines = map(str.strip, f.readlines()) commands = [commandfactory.parse_input(line) for line in input_lines] self.__map = Map() for input_cmd in commands: if isinstance(input_cmd, SuperRegionsCmd): self.__map.init_super_regions(input_cmd.super_region_to_reward()) elif isinstance(input_cmd, RegionsCmd): self.__map.init_regions(input_cmd.region_to_super_region()) elif isinstance(input_cmd, NeighborsCmd): self.__map.init_neighbors(input_cmd.region_to_neighbors())
def get_sample_map1(): input_file_name = './sample_map1.txt' with open(input_file_name) as f: input_lines = map(str.strip, f.readlines()) commands = [commandfactory.parse_input(line) for line in input_lines] map1 = Map() for input_cmd in commands: if isinstance(input_cmd, SuperRegionsCmd): map1.init_super_regions(input_cmd.super_region_to_reward()) elif isinstance(input_cmd, RegionsCmd): map1.init_regions(input_cmd.region_to_super_region()) elif isinstance(input_cmd, NeighborsCmd): map1.init_neighbors(input_cmd.region_to_neighbors()) situation1 = Situation(map1) return map1, situation1