def cost_to_all_cells(filename, src_waypoint, output_filename): """ Loads a level, calculates the cost to all reachable cells from src_waypoint, then saves the result in a csv file with name output_filename. Args: filename: The name of the text file containing the level. src_waypoint: The character associated with the initial waypoint. output_filename: The filename for the output csv file. """ # Load and display the level. level = load_level(filename) show_level(level) # Retrieve the source coordinates from the level. src = level['waypoints'][src_waypoint] # Calculate the cost to all reachable cells from src and save to a csv file. costs_to_all_cells = dijkstras_shortest_path_to_all(src, level, navigation_edges) save_level_costs(level, costs_to_all_cells, output_filename)
def cost_to_all_cells(filename, src_waypoint, output_filename): """ Loads a level, calculates the cost to all reachable cells from src_waypoint, then saves the result in a csv file with name output_filename. Args: filename: The name of the text file containing the level. src_waypoint: The character associated with the initial waypoint. output_filename: The filename for the output csv file. """ # Load and display the level. level = load_level(filename) show_level(level) # Retrieve the source coordinates from the level. src = level['waypoints'][src_waypoint] # Calculate the cost to all reachable cells from src and save to a csv file. costs_to_all_cells = dijkstras_shortest_path_to_all( src, level, navigation_edges) save_level_costs(level, costs_to_all_cells, output_filename)