blog/static/files/algorithms/paths/bf-to-astar/main.cpp
Matej Focko d16eaafd97
algorithms(bf-to-astar): add intro
Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-01-03 15:06:12 +01:00

34 lines
1 KiB
C++

#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include "astar.hpp"
#include "bf.hpp"
#include "dijkstra.hpp"
#include "graph.hpp"
auto line_to_vector(const std::string& l) -> std::vector<char> {
return std::vector(l.begin(), l.end());
}
auto main() -> int {
graph g{std::vector{
line_to_vector(std::string("#############")),
line_to_vector(std::string("#..#..*.*.**#")),
line_to_vector(std::string("##***.....**#")),
line_to_vector(std::string("#..########.#")),
line_to_vector(std::string("#...###...#.#")),
line_to_vector(std::string("#..#...##.#.#")),
line_to_vector(std::string("#..#.*.#..#.#")),
line_to_vector(std::string("#....#....#.#")),
line_to_vector(std::string("########*.*.#")),
line_to_vector(std::string("#...........#")),
line_to_vector(std::string("#############")),
}};
std::cout << "Normal cost: " << g.normal_cost() << "\n";
std::cout << "Vortex cost: " << g.vortex_cost() << "\n";
std::cout << "Graph:\n" << g;
return 0;
}