aboutsummaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
Diffstat (limited to 'path.c')
-rw-r--r--path.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/path.c b/path.c
index fd92908..a8410fc 100644
--- a/path.c
+++ b/path.c
@@ -348,6 +348,16 @@ void visited_free(char **visited, size_t height) {
return;
}
+size_t visited_count(char **visited, size_t width, size_t height) {
+ size_t count = 0;
+ for (size_t row = 0; row < height; row++) {
+ for (size_t col = 0; col < width; col++) {
+ if (visited[row][col]) count++;
+ }
+ }
+ return count;
+}
+
size_t **cost_so_far_new(size_t width, size_t height) {
size_t **cost_so_far = malloc(sizeof(size_t*) * height);
if (cost_so_far == NULL) return NULL;