Skip to content
Snippets Groups Projects
Commit 9e055f7e authored by agnon.kurteshi's avatar agnon.kurteshi
Browse files

push selon autorisation

parent ad5f4791
Branches main
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ frmi create_fourmi(int nb_sommet)
fr->path = malloc(sizeof(stack));
stack_init(fr->path, nb_sommet);
fr->distance = 0;
fr->ttl = nb_sommet;
return fr;
}
......
......@@ -14,6 +14,7 @@ typedef struct _fourmi
stack *path;
int distance; //stocke la distane parcourue par la fourmi
int depose_pheromone; //permet d'activer le dépôt de phéromones
int ttl;
}f;
typedef f *frmi;
......
......@@ -236,7 +236,8 @@ void create_graph_vis(graph g)
void shortest_path(graph g, frmi f, int noeud)
{
if (noeud == g->nourriture)
f->ttl--;
if (noeud == g->nourriture || f->ttl == 0)
{
stack_push(f->path, noeud);
return;
......
the shortest path is [0][1][3][7] with a cost of 8
the shortest path is
\ No newline at end of file
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment