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

This file contains the function prototypes for the floodfill algorithm for mapping of the maze. More...

#include <stdint.h>
#include "pathfinding/maze.h"
Include dependency graph for floodfill.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef uint16_t(* floodfill_explore_func_t) (maze_grid_t *p_grid, maze_navigator_state_t *p_navigator, maze_cardinal_direction_t direction)
 This function pointer type is used to explore the maze. It is expected to return the walls that the robot sees. More...
 
typedef void(* floodfill_move_navigator_t) (maze_navigator_state_t *p_navigator, maze_cardinal_direction_t direction)
 Moves the navigator/robot in the specified direction. More...
 

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 function prototypes for the floodfill algorithm for mapping of the maze.

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

Typedef Documentation

◆ floodfill_explore_func_t

floodfill_explore_func_t

This function pointer type is used to explore the maze. It is expected to return the walls that the robot sees.

Parameters
p_gridPointer to the maze.
p_navigatorPointer to the navigator state.
directionDirection to explore.
Returns
int16_t Returns a bitmask of the walls.

◆ floodfill_move_navigator_t

floodfill_move_navigator_t

Moves the navigator/robot in the specified direction.

Parameters
p_navigatorPointer to the navigator state.
directionDirection to move.

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: