A-maze-D documentation 1.0.0
Loading...
Searching...
No Matches
path_finding.c File Reference

The path_finding.c. More...

Functions

int get_heuristic_distance (room_t *start, room_t *end)
 Get the heuristic distance between two rooms.
 
path_tget_lowest_score_node (linked_list_t *possible_paths)
 Get the node with the lowest score in the possible paths list.
 
void browse_neighbors (path_info_t *path_info)
 Browse the neighbors of a room and create a path node for each neighbor room and add them to possible paths.
 
path_tget_best_path (room_t *start, room_t *end, my_bool_t only_free_room)
 Get the best path between two rooms.
 
void display_path (path_t *path)
 Display the path found.
 

Detailed Description

The path_finding.c.

Author
Nicolas TORO

Function Documentation

◆ browse_neighbors()

void browse_neighbors ( path_info_t * path_info)

Browse the neighbors of a room and create a path node for each neighbor room and add them to possible paths.

Parameters
path_infoThe path information
Returns
void
Author
Nicolas TORO

◆ display_path()

void display_path ( path_t * path)

Display the path found.

Parameters
pathThe path to display
Returns
void
Author
Nicolas TORO

◆ get_best_path()

path_t * get_best_path ( room_t * start,
room_t * end,
my_bool_t only_free_room )

Get the best path between two rooms.

Parameters
startThe starting room
endThe ending room
only_free_roomIf we only want to browse free rooms
Returns
path_t * The best path found (NULL if no path found)
Author
Nicolas TORO

◆ get_heuristic_distance()

int get_heuristic_distance ( room_t * start,
room_t * end )

Get the heuristic distance between two rooms.

Note
In our case, the heuristic distance is the number of iterations to go from one room to the end room
Parameters
startThe starting room
endThe ending room
Returns
int The heuristic distance (if the room is connected to the end room, then the number of iterations, else -1)
Author
Nicolas TORO

◆ get_lowest_score_node()

path_t * get_lowest_score_node ( linked_list_t * possible_paths)

Get the node with the lowest score in the possible paths list.

Parameters
possible_pathsThe list of possible paths
Returns
path_t * The node with the lowest score
Author
Nicolas TORO