This file contains the implementation of the floodfill algorithm for mapping the maze and determining a path to the end. More...
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include "pathfinding/maze.h"
#include "pathfinding/binary_heap.h"
#include "pathfinding/floodfill.h"
Functions | |
void | floodfill_init_maze_nowall (maze_grid_t *p_grid) |
This function initialises a maze with no walls to perform the floodfill algorithm on. More... | |
void | floodfill_map_maze (maze_grid_t *p_grid, const maze_grid_cell_t *p_end_node, maze_navigator_state_t *p_navigator, floodfill_explore_func_t p_explore_func, floodfill_move_navigator_t p_move_navigator) |
Runs the floodfill algorithm to map out the maze. More... | |
This file contains the implementation of the floodfill algorithm for mapping the maze and determining a path to the end.
void floodfill_init_maze_nowall | ( | maze_grid_t * | p_grid | ) |
This function initialises a maze with no walls to perform the floodfill algorithm on.
[in,out] | p_grid | Pointer to the maze. |
References maze_grid::columns, maze_grid_cell::coordinates, maze_grid_cell::f, maze_grid_cell::g, maze_grid_cell::h, maze_grid_cell::is_visited, maze_get_cell_in_dir(), maze_grid_cell::p_came_from, maze_grid::p_grid_array, maze_grid_cell::p_next, and maze_grid::rows.
void floodfill_map_maze | ( | maze_grid_t * | p_grid, |
const maze_grid_cell_t * | p_end_node, | ||
maze_navigator_state_t * | p_navigator, | ||
floodfill_explore_func_t | p_explore_func, | ||
floodfill_move_navigator_t | p_move_navigator | ||
) |
Runs the floodfill algorithm to map out the maze.
[in,out] | p_grid | Pointer to the initialised maze with no walls. |
[in] | p_end_node | Pointer to the end node. |
[in,out] | p_navigator | Pointer to the navigator state. |
[in] | p_explore_func | Pointer to the function that will explore the maze. |
[in] | p_move_navigator | Pointer to the function that will move the navigator. |
References binary_heap::capacity, maze_grid::columns, maze_grid_cell::f, maze_grid_cell::g, maze_grid_cell::h, maze_clear_heuristics(), MAZE_NONE, maze_navigator_state::orientation, binary_heap::p_array, maze_navigator_state::p_current_node, maze_grid::p_grid_array, maze_grid_cell::p_next, maze_grid::rows, and binary_heap::size.