aboutsummaryrefslogtreecommitdiff
path: root/map.h
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-04-23 13:48:37 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-04-23 13:48:37 +0300
commit483c635bda691556084042710f3f5c5f0d81c047 (patch)
tree98a2b2a0fb9b41d6a0c1711b4309a9e7cf48fb84 /map.h
parent092fbe195d22dfecb768c98f91b6ab733f1bb72f (diff)
downloadastar-483c635bda691556084042710f3f5c5f0d81c047.tar.xz
Implement 4dir wraparound
Diffstat (limited to 'map.h')
-rw-r--r--map.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/map.h b/map.h
index 7faa597..16c731f 100644
--- a/map.h
+++ b/map.h
@@ -20,11 +20,17 @@ 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[4], size_t cost_array[4], Position pos, size_t width, size_t height, \
char **visited, size_t **costs);
+/* Same as above, but walls wrap around. IMPORTANT: the heuristic is tuned to no wraparound, so only dijkstras will work correctly */
+unsigned int neighbours_4dir_wraparound(Position neighbour_array[4], size_t cost_array[4], Position pos, size_t width, size_t height, \
+ char **visited, size_t **costs);
/* Stores all the existing 8dir neighbours of pos in neighbour_array and returns their amount.
* Additionaly stores costs into cost_array if it's not NULL.
* The cost of goint orthogonally is 10, diagonaly is 14 (sqrt(2) * 10) */
unsigned int neighbours_8dir(Position neighbour_array[8], size_t cost_array[8], Position pos, size_t width, size_t height, \
char **visited, size_t **costs);
+/* Same as above, but walls wrap around. IMPORTANT: the heuristic is tuned to no wraparound, so only dijkstras will work correctly */
+unsigned int neighbours_8dir_wraparound(Position neighbour_array[8], size_t cost_array[8], Position pos, size_t width, size_t height, \
+ char **visited, size_t **costs);
/* 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!