def remove_all_dead_ends(maze):
    height, width = maze.shape
    while True:
        maze_graph, start_node = walls_to_graph(maze[1:height - 1,
                                                     1:width // 2])
        dead_ends = find_dead_ends(maze_graph,
                                   start_node, width // 2 - 1)
        if len(dead_ends) == 0:
            break

        remove_dead_end(dead_ends[0], maze[1:height - 1, 1:width // 2])
dataset/ETHPy150Open ASPP/pelita/layouts/maze_generator.py/remove_all_dead_ends/original