def main(algo):
    print('New/load ? n / l')
    ans = input()
    if ans == 'n':
        input_message = "Enter the size of your maze (height x width)\n"
        maze_height, maze_width = map(int, input(input_message).split())
        graph = Graph(maze_height, maze_width)
        if algo == 1:
            dfs_generation(graph)
            print("Generating with DFS...")
        elif algo == 2:
            kruskal_generation(graph)
            print("Generating with Kruskal algorithm")
        m = create_maze(graph)
        print_maze(m)
        print('Would you like to save it? y/n')
        ans = input()
        if ans == 'y':
            write_maze(m)
    else:
        print('Enter file name')
        file = input()
        m = open_maze(file)
    print('Would you like to solve it? y/n')
    ans = input()
    if ans == 'y':
        bfs(m)
        print_maze(m)
Beispiel #2
0
def test_big_input_bfs_2():
    m = open_maze("tests/big_input_2.txt")
    start_time = time.time()
    bfs(m)
    test_time = time.time() - start_time
    print("bfs big_input_2 time", test_time)
    assert test_time < 2
def test_input5_bfs():
    m = open_maze("tests/input5.txt")
    start_time = time.time()
    bfs(m)
    test_time = time.time() - start_time
    print("bfs input5", test_time)