-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathastarMd.h
91 lines (76 loc) · 3.03 KB
/
astarMd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#ifndef ASTARMD_H
#define ASTARMD_H
#include "struct.h"
//#include "labyrinthAPI.h"
/*! \file astarMd.h
\brief A* related functions descriptions.
\author Maeva Arlandis et Alexis Devillard
\version 6.2
\date 10 janvier 2017
*/
/*! \fn int astarMode(Map *L);
\brief Generate simple A* behavior.
\param L The labyrinth map structure.
*/
int astarMode(Map *L);
/*! \fn void astarMv(Map* L, int P,t_move* move);
\brief Generate the shortest path to the goal with an A* algo.
\param L The labyrinth map structure.
\param P the player from which the path wll start.
\param move the to do.
*/
void astarMv(Map* L, int P,t_move* move);
/*! \fn Path * astarPath(Map *L,int P);
\brief Generate the shortest path to the goal with an A* algo.
\param L The labyrinth map structure.
\param P the player from which the path wll start.
*/
Path * astarPath(Map* L, int P);
/*! \fn Node *initOpenList(Map *L,int x, int y,char ** nds)
\brief Initialise and return the node of the position (x,y).
\param L The labyrinth map structure.
\param x The x coordinate of the staring point.
\param y The y coordinate of the staring point.
\param nds The character array of 0/1 (making easier checking if cases have been checked.)
*/
Node *initOpenList(Map *L,int x, int y,char ** nds);
/*! \fn Node *newNode(Map *L,int x, int y,Node * neigh,char ** nds);
\brief Initialise and return the node cominf from fromN.
\param L The labyrinth map structure.
\param x The x coordinate of the staring point.
\param y The y coordinate of the staring point.
\param nds The character array of 0/1 (making easier checking if cases have been checked.)
*/
Node *newNode(Map *L,int x, int y,Node * parent,char ** nds);
/*! \fn Node * addNeigh(Map* L,Node* OpL,char** nds);
\brief try to create a node for each neighbor, and add them to the open list.
\param L The labyrinth map structure.
\param OpL The open list.
\param nds The character array of 0/1 (making easier checking if cases have been checked.)
*/
Node * addNeigh(Map* L,Node* OpL,char** nds);
/*! \fn Node * extractPath(Node * clL);
\brief Starting from the goal, iterativly,freing node that are not pathParent,taking pathParent node and put last node adress in its pathChild.
\param clL closed list The open list.
*/
Node * extractPath(Node * clL);
/*! \fn Node* addToList(Node *N1,Node* NtoAdd);
\brief Add a node to a list sort heuristicly increasing
\param N1 First node of the the list to add.
\param NtoAdd node to add to the list.
*/
Node* addToList(Node* N1,Node* NtoAdd);
/*! \fn int rmOList(Node* first);
\brief Free each node of the list
\param first First of the the list to remove.
*/
int rmOList(Node* first);
/*! \fn int distNtoP(Map *L,int P,Node *N)
\brief Calculate the distance as the crows fly from the node N to the player P.
\param L The labyrinth map structure.
\param P Number of the Player.
\param N Pointer to the Node.
*/
int distNtoP(Map *L,int P,Node *N);
int rmPath(Path *p);
#endif