INF2004-Project v0.1
 
Loading...
Searching...
No Matches
floodfill.c File Reference

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"
Include dependency graph for floodfill.c:

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...
 

Detailed Description

This file contains the implementation of the floodfill algorithm for mapping the maze and determining a path to the end.

Author
Christopher Kok (chris.nosp@m.@for.nosp@m.celig.nosp@m.htni.nosp@m.ng.xy.nosp@m.z)
Version
0.1
Date
2023-11-07

Function Documentation

◆ floodfill_init_maze_nowall()

void floodfill_init_maze_nowall ( maze_grid_t p_grid)

This function initialises a maze with no walls to perform the floodfill algorithm on.

Parameters
[in,out]p_gridPointer 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.

Here is the call graph for this function:

◆ floodfill_map_maze()

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.

Parameters
[in,out]p_gridPointer to the initialised maze with no walls.
[in]p_end_nodePointer to the end node.
[in,out]p_navigatorPointer to the navigator state.
[in]p_explore_funcPointer to the function that will explore the maze.
[in]p_move_navigatorPointer 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.

Here is the call graph for this function: