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:
parent
c36f501b08
commit
ae93873452
3
Makefile
3
Makefile
@ -6,7 +6,7 @@
|
|||||||
# By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ #
|
# By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2019/03/27 16:51:02 by tmaze #+# #+# #
|
# Created: 2019/03/27 16:51:02 by tmaze #+# #+# #
|
||||||
# Updated: 2019/04/05 15:14:01 by tmaze ### ########.fr #
|
# Updated: 2019/04/06 13:46:23 by tmaze ### ########.fr #
|
||||||
# #
|
# #
|
||||||
#******************************************************************************#
|
#******************************************************************************#
|
||||||
|
|
||||||
@ -43,6 +43,7 @@ SRC = lm_parser.c \
|
|||||||
bfs.c \
|
bfs.c \
|
||||||
lst_ind.c \
|
lst_ind.c \
|
||||||
edmunds_karp.c \
|
edmunds_karp.c \
|
||||||
|
push_ants.c \
|
||||||
# lem_in.c
|
# lem_in.c
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/03/23 17:31:19 by tmaze #+# #+# */
|
/* Created: 2019/03/23 17:31:19 by tmaze #+# #+# */
|
||||||
/* Updated: 2019/04/03 15:57:39 by tmaze ### ########.fr */
|
/* Updated: 2019/04/06 13:49:17 by tmaze ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -50,6 +50,15 @@ typedef struct s_bfs
|
|||||||
int queue;
|
int queue;
|
||||||
} t_bfs;
|
} t_bfs;
|
||||||
|
|
||||||
|
typedef struct s_ants
|
||||||
|
{
|
||||||
|
int nb_ant;
|
||||||
|
int nb_path;
|
||||||
|
int nb_node;
|
||||||
|
char end;
|
||||||
|
struct s_ants *next;
|
||||||
|
} t_ants;
|
||||||
|
|
||||||
//LEM_IN MT STRUCTS
|
//LEM_IN MT STRUCTS
|
||||||
|
|
||||||
typedef struct s_syntax
|
typedef struct s_syntax
|
||||||
|
42
srcs/test.c
42
srcs/test.c
@ -6,7 +6,7 @@
|
|||||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/03/28 11:37:06 by tmaze #+# #+# */
|
/* 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));
|
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)
|
int main(void)
|
||||||
{
|
{
|
||||||
t_lmdata data;
|
t_lmdata data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user