// Paso 4: la tabla para el informe. Compara BFS y DFS en laberintos sin ciclos y con ciclos.
#include <iomanip>
#include <iostream>
#include <random>

#include "maze.h"
#include "solver.h"

int main() {
    const int width = 40;
    const int height = 20;
    std::cout << "laberinto de " << width << " x " << height << ", " << width * height << " celdas\n";
    std::cout << "extra  semilla  camino BFS  camino DFS  visitados BFS  visitados DFS\n";
    for (int extra : {0, 40, 200}) {
        for (int seed = 1; seed <= 5; seed++) {
            std::mt19937 rng(static_cast<std::mt19937::result_type>(seed));
            Maze maze(width, height);
            generate_maze(maze, rng);
            open_extra_walls(maze, extra, rng);
            Graph graph = maze_graph(maze);
            int target = maze.cell_count() - 1;
            SearchResult by_bfs = bfs_search(graph, 0, target);
            SearchResult by_dfs = dfs_search(graph, 0, target);
            std::cout << std::setw(5) << extra << std::setw(9) << seed << std::setw(12) << by_bfs.path.size() - 1
                      << std::setw(12) << by_dfs.path.size() - 1 << std::setw(15) << by_bfs.visited.size()
                      << std::setw(15) << by_dfs.visited.size() << "\n";
        }
    }
    return 0;
}
