def do_one((maze_gen, extend_map)): map_count = 0 while map_count < number_of_runs: thrown = 0 zmap, homes = maps.make_map_with_ants_on_vacancies( default_homes=[(2,2), (3,7)], make_map=maze_gen, make_homes=maps.random_homes) a = astar(homes, zmap) if a is None or a < 20: thrown += 1 continue print("ASTAR: %d (thrown %d)" % (a, thrown)) if extend_map: xmap = extend_and_add_trap_to_map(zmap) else: xmap = zmap return xmap, homes, {'closed': not extend_map} map_count += 1
def randomize(k): s.zmap, s.homes = make_map_with_ants_on_vacancies( default_homes=default_homes, make_map=make_map, make_homes=make_homes ) s.board_size = (len(s.zmap), len(s.zmap[0]))
def randomize(): make_map, make_homes = random_map_pair zmap, homes = maps.make_map_with_ants_on_vacancies( default_homes=[(2,2), (3,7)], make_map=make_map, make_homes=make_homes) return zmap, homes