From beef612173fe3840dff4c4bd9fc0c25e469a9aa6 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Sun, 3 May 2026 21:01:00 +0300 Subject: Comments --- path.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'path.h') diff --git a/path.h b/path.h index f4f21e8..3b9672d 100644 --- a/path.h +++ b/path.h @@ -10,7 +10,7 @@ extern char *path_func_string; /* Time it took to calculate a path */ extern double path_time; -/* Controls whether walls should wrap around, only works in Dijkstra's */ +/* Controls whether walls should wrap around, only works in Dijkstra's due to A*'s heuristic */ extern char wraparound_enabled; /* dirs can be 4 or 8 to disallow or allow diagonal movement */ @@ -18,8 +18,10 @@ extern char wraparound_enabled; Path dijkstra_path(int dirs, Map map, size_t **cell_costs, size_t width, size_t height, Position start, Position end, char **visited, char should_anim); Path astar_path(int dirs, Map map, size_t **cell_costs, size_t width, size_t height, Position start, Position end, char **visited, char should_anim); -size_t manhattan_distance(Position a, Position b); -size_t diagonal_distance(Position a, Position b); +/* Heuristic functions. Calculate the distance from a to b */ +size_t manhattan_distance(Position a, Position b); /* Used for 4 dirs */ +size_t diagonal_distance(Position a, Position b); /* Used for 8 dirs */ + Path path_new(size_t width, size_t height); void path_free(Path path, size_t height); -- cgit v1.2.3