def test_pathing_influence(self, map_data: MapData, caplog: LogCaptureFixture) -> None: logger.info(map_data) base = map_data.bot.townhalls[0] reg_start = map_data.where_all(base.position_tuple)[0] reg_end = map_data.where_all(map_data.bot.enemy_start_locations[0].position)[0] p0 = reg_start.center p1 = reg_end.center pts = [] r = 10 for i in range(50): pts.append(get_random_point(0, 200, 0, 200)) arr = map_data.get_pyastar_grid() for p in pts: arr = map_data.add_cost(p, r, arr) path = map_data.pathfind(p0, p1, grid=arr) assert (path is not None)
def test_handle_illegal_values(self, map_data: MapData) -> None: base = map_data.bot.townhalls[0] reg_start = map_data.where_all(base.position_tuple)[0] assert (isinstance(reg_start, Region)), f"reg_start = {reg_start}, base = {base}, position_tuple = {base.position_tuple}" reg_end = map_data.where_all(map_data.bot.enemy_start_locations[0].position)[0] p0 = reg_start.center p1 = reg_end.center pts = [] r = 10 for i in range(50): pts.append(get_random_point(-500, -250, -500, -250)) arr = map_data.get_pyastar_grid() for p in pts: arr = map_data.add_cost(p, r, arr) path = map_data.pathfind(p0, p1, grid=arr) assert (path is not None), f"path = {path}"