aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
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;