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
15
Makefile
15
Makefile
@ -6,7 +6,7 @@
|
||||
# By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# 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 #
|
||||
# #
|
||||
#******************************************************************************#
|
||||
|
||||
@ -36,13 +36,14 @@ OBJDIR = objs
|
||||
INCDIR = includes libft/includes
|
||||
|
||||
# Source files
|
||||
SRC = lm_parser.c \
|
||||
lm_mem_utils.c \
|
||||
lm_graph_utils.c \
|
||||
SRC = lm_parser.c \
|
||||
lm_mem_utils.c \
|
||||
lm_graph_utils.c \
|
||||
lm_check_errors.c \
|
||||
bfs.c \
|
||||
lst_ind.c \
|
||||
edmunds_karp.c \
|
||||
bfs.c \
|
||||
lst_ind.c \
|
||||
edmunds_karp.c \
|
||||
push_ants.c \
|
||||
# lem_in.c
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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;
|
||||
} 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
|
||||
|
||||
typedef struct s_syntax
|
||||
|
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user