push_ants done need to test
done all mechanism to display ants moving in the graph still need testing still need norming
This commit is contained in:
42
srcs/test.c
42
srcs/test.c
@@ -6,7 +6,7 @@
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/03/28 11:37:06 by tmaze #+# #+# */
|
||||
/* Updated: 2019/04/05 17:43:06 by tmaze ### ########.fr */
|
||||
/* Updated: 2019/04/06 13:51:55 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -20,46 +20,6 @@ int add_link(t_lmdata *data, int n1, int n2)
|
||||
return (lst_indadd(&(data->adj[n1]), n2) && lst_indadd(&(data->adj[n2]), n1));
|
||||
}
|
||||
|
||||
t_node *get_node(t_lmdata *data, int index)
|
||||
{
|
||||
t_node *it;
|
||||
|
||||
it = data->node_data;
|
||||
while (it && it->index != index)
|
||||
it = it->next;
|
||||
return (it);
|
||||
}
|
||||
|
||||
void push_ants(t_lmdata *data, t_ind **paths, int nb_paths, int nb_ants)
|
||||
{
|
||||
t_ind *its[nb_path];
|
||||
int ant_p[nb_path];
|
||||
int ant_c;
|
||||
int i;
|
||||
char end;
|
||||
|
||||
i = 0;
|
||||
end = 0;
|
||||
while (i < nb_paths)
|
||||
{
|
||||
its[i] = paths[i];
|
||||
i++;
|
||||
}
|
||||
ant_c = 0;
|
||||
while (++ant_c <= nb_paths)
|
||||
ant_p[ant_c - 1] = ant_c]
|
||||
while (!end)
|
||||
{
|
||||
i = 0;
|
||||
while (i < nb_paths)
|
||||
{
|
||||
ft_printf("L%d-%s", ant_p[i], get_node(data, its[i]->index)->name);
|
||||
if (i < nb_path - 1)
|
||||
ft_putchar(' ');
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
t_lmdata data;
|
||||
|
Reference in New Issue
Block a user