From 5b13d9bfa2b14c1231c5b19a9ccffb2d308112e4 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Sun, 22 Mar 2026 13:40:21 +0300 Subject: Implement 8dir breadth-first-search and some other stuff --- map.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'map.h') diff --git a/map.h b/map.h index 09e5c90..d940357 100644 --- a/map.h +++ b/map.h @@ -4,7 +4,7 @@ #include #include "structs.h" #include "path.h" - +#include "priority_queue.h" /* Returns an empty map of given size */ Map empty_map(size_t width, size_t height); @@ -12,6 +12,9 @@ Map empty_map(size_t width, size_t height); /* Stores all the existing 4dir neighbours of pos in neighbour_array and returns their amount */ unsigned int neighbours_4dir(Position neighbour_array[], Position pos, size_t width, size_t height, \ char visited[height][width]); +/* Stores all the existing 8dir neighbours of pos in neighbour_array and returns their amount */ +unsigned int neighbours_8dir(Position neighbour_array[], Position pos, size_t width, size_t height, \ + char visited[height][width]); /* https://en.wikipedia.org/wiki/Maze_generation_algorithm#Randomized_depth-first_search * WARNING: width and height are not the width and height of the returned map! @@ -35,8 +38,8 @@ Map rbt_maze_map(size_t width, size_t height, unsigned int seed); Map file_plaintext_map(char *filename, size_t *width, size_t *height, Position *start_pos, Position *end_pos); /* Draw the map. Bet you didn't expect that. - * path could be NULL to draw a map with no path */ -void draw_map(Map map, size_t width, size_t height, int offset_x, int offset_y, Position start, Position goal, Path path, char visited[height][width]); + * path could be NULL to draw a map with no path. So can cursor, frontier and visited */ +void draw_map(Map map, size_t width, size_t height, int offset_x, int offset_y, Position start, Position goal, Position *cursor, Path path, char visited[height][width], PositionPQ *frontier); void print_map_out(Map map, size_t width, size_t height); -- cgit v1.2.3