aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-29 21:02:43 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-29 21:02:43 +0300
commit2a9f8b25aaea4385b427ab0a6fc5a4037f669a81 (patch)
treecdcad71ca55a2d9b71ac628556018f594ae92c37 /main.c
parent0da3ed44b904b3e5c8d61a236069b2fff1508a7f (diff)
downloadastar-2a9f8b25aaea4385b427ab0a6fc5a4037f669a81.tar.xz
Implement Dijkstra's algorithm
Diffstat (limited to 'main.c')
-rw-r--r--main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/main.c b/main.c
index eded452..317a237 100644
--- a/main.c
+++ b/main.c
@@ -56,6 +56,7 @@ int main(int argc, char **argv) {
Position start_pos, end_pos;
size_t width, height;
Map map = NULL;
+ Path (*path_func)(int, Map, size_t, size_t, Position, Position, char **, char) = &dijkstra_path;
size_t mwidth = 20; /* Maze width */
size_t mheight = 10; /* Maze height */
@@ -134,7 +135,7 @@ int main(int argc, char **argv) {
char **visited = visited_new(width, height);
Path path = NULL;
- path = breadth_first_search_path(dirs, map, width, height, start_pos, end_pos, visited, anim);
+ path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim);
if (bmp_only) {
map_to_bmp(map, width, height, start_pos, end_pos, path, visited, bmp_filename);
@@ -174,7 +175,7 @@ int main(int argc, char **argv) {
map = rbt_maze_map(mwidth, mheight, rand());
visited = visited_new(width, height);
- path = breadth_first_search_path(dirs, map, width, height, start_pos, end_pos, visited, anim);
+ path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim);
}
break;
case 's':
@@ -188,7 +189,7 @@ int main(int argc, char **argv) {
map_free(map, height);
map = rbt_maze_map(mwidth, mheight, rand());
path_free(path, height);
- path = breadth_first_search_path(dirs, map, width, height, start_pos, end_pos, visited, anim);
+ path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim);
}
break;
case 'q': map_free(map, height); path_free(path, height); endwin(); return 0;