Compare commits
21 Commits
Mthandazo4
...
a8b2e31701
Author | SHA1 | Date | |
---|---|---|---|
|
a8b2e31701 | ||
|
c6339a00e9 | ||
|
bfb125f503 | ||
|
4a5c798b25 | ||
|
9b75432c2e | ||
|
d85e0873cb | ||
|
0495ba9e55 | ||
|
eb85b914a4 | ||
|
86b0530bf7 | ||
|
8c4a6aac25 | ||
|
5d094ebcaf | ||
|
fb66233265 | ||
|
3b893147e5 | ||
|
434b629055 | ||
|
08e622a4f0 | ||
|
a2fd180398 | ||
|
ae93873452 | ||
|
c36f501b08 | ||
|
0a9d7b816d | ||
|
ea0eda89d0 | ||
|
15669b7402 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "libft"]
|
|
||||||
path = libft
|
|
||||||
url = https://github.com/tvdu29/libft
|
|
24
Makefile
24
Makefile
@@ -6,11 +6,11 @@
|
|||||||
# 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/03/31 19:48:45 by tmaze ### ########.fr #
|
# Updated: 2019/04/22 09:44:46 by tmaze ### ########.fr #
|
||||||
# #
|
# #
|
||||||
#******************************************************************************#
|
#******************************************************************************#
|
||||||
|
|
||||||
NAME = lem_in
|
NAME = lem-in
|
||||||
|
|
||||||
# Make options
|
# Make options
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
@@ -27,7 +27,7 @@ endif
|
|||||||
|
|
||||||
# Compilator
|
# Compilator
|
||||||
CC = gcc
|
CC = gcc
|
||||||
FLAGS = -Wall -Wextra -Werror -g -O0 -fsanitize=address
|
FLAGS = -Wall -Wextra -Werror -g
|
||||||
|
|
||||||
# Folders
|
# Folders
|
||||||
LIBDIR = libft
|
LIBDIR = libft
|
||||||
@@ -36,7 +36,23 @@ OBJDIR = objs
|
|||||||
INCDIR = includes libft/includes
|
INCDIR = includes libft/includes
|
||||||
|
|
||||||
# Source files
|
# Source files
|
||||||
SRC = lem_in.c lm_parser.c lm_mem_utils.c lm_graph_utils.c lm_check_errors.c \
|
SRC = lm_parser.c \
|
||||||
|
lm_mem_utils.c \
|
||||||
|
lm_check_errors.c \
|
||||||
|
lm_data_utils.c \
|
||||||
|
lm_initdata.c \
|
||||||
|
lm_mem_utils.c \
|
||||||
|
lm_graph_utils.c \
|
||||||
|
lm_parser_error_check.c \
|
||||||
|
lm_utils_parser.c \
|
||||||
|
bfs.c \
|
||||||
|
lst_ind.c \
|
||||||
|
edmonds_karp.c \
|
||||||
|
push_ants.c \
|
||||||
|
push_ants_utils.c \
|
||||||
|
score_utils.c \
|
||||||
|
lem_in.c
|
||||||
|
|
||||||
|
|
||||||
OBJ = $(SRC:.c=.o)
|
OBJ = $(SRC:.c=.o)
|
||||||
|
|
||||||
|
BIN
Oglibft/.DS_Store
vendored
BIN
Oglibft/.DS_Store
vendored
Binary file not shown.
@@ -6,16 +6,14 @@
|
|||||||
/* 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/03/31 17:58:52 by tmaze ### ########.fr */
|
/* Updated: 2019/04/22 10:01:33 by tmaze ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#ifndef LEM_IN_H
|
#ifndef LEM_IN_H
|
||||||
# define LEM_IN_H
|
# define LEM_IN_H
|
||||||
|
|
||||||
# include "libft.h"
|
# include "libft.h"
|
||||||
# include "limits.h"
|
# include "limits.h"
|
||||||
# include <fcntl.h>
|
|
||||||
|
|
||||||
typedef struct s_node
|
typedef struct s_node
|
||||||
{
|
{
|
||||||
@@ -38,7 +36,7 @@ typedef struct s_lmdata
|
|||||||
{
|
{
|
||||||
int nbants;
|
int nbants;
|
||||||
int nb_nodes;
|
int nb_nodes;
|
||||||
t_list *nodes;
|
int nb_paths_max;
|
||||||
t_node *nodes_data;
|
t_node *nodes_data;
|
||||||
t_ind **adj;
|
t_ind **adj;
|
||||||
} t_lmdata;
|
} t_lmdata;
|
||||||
@@ -47,10 +45,18 @@ typedef struct s_bfs
|
|||||||
{
|
{
|
||||||
int parent;
|
int parent;
|
||||||
char visited;
|
char visited;
|
||||||
|
char old_visited;
|
||||||
int queue;
|
int queue;
|
||||||
} t_bfs;
|
} t_bfs;
|
||||||
|
|
||||||
//LEM_IN MT STRUCTS
|
typedef struct s_ants
|
||||||
|
{
|
||||||
|
int nb_ant;
|
||||||
|
int nb_path;
|
||||||
|
int nb_node;
|
||||||
|
char end;
|
||||||
|
struct s_ants *next;
|
||||||
|
} t_ants;
|
||||||
|
|
||||||
typedef struct s_syntax
|
typedef struct s_syntax
|
||||||
{
|
{
|
||||||
@@ -58,20 +64,18 @@ typedef struct s_syntax
|
|||||||
int s_cmd;
|
int s_cmd;
|
||||||
int s_pos;
|
int s_pos;
|
||||||
int error;
|
int error;
|
||||||
|
int s_error;
|
||||||
|
int e_error;
|
||||||
|
int v_error;
|
||||||
|
int l_error;
|
||||||
|
int gr_status;
|
||||||
int s_vert;
|
int s_vert;
|
||||||
int e_vert;
|
int e_vert;
|
||||||
int gr_status;
|
|
||||||
int e_cmd;
|
int e_cmd;
|
||||||
int e_pos;
|
int e_pos;
|
||||||
int v_flag;
|
int v_flag;
|
||||||
} t_syntax;
|
} t_syntax;
|
||||||
|
|
||||||
typedef struct s_AdjListNode
|
|
||||||
{
|
|
||||||
int dest;
|
|
||||||
struct s_AdjListNode *next;
|
|
||||||
} t_adjlist;
|
|
||||||
|
|
||||||
typedef struct s_temp
|
typedef struct s_temp
|
||||||
{
|
{
|
||||||
int src_ind;
|
int src_ind;
|
||||||
@@ -85,48 +89,58 @@ typedef struct s_holder
|
|||||||
t_temp *data;
|
t_temp *data;
|
||||||
} t_holder;
|
} t_holder;
|
||||||
|
|
||||||
typedef struct s_AdjList
|
typedef struct s_rdata
|
||||||
{
|
{
|
||||||
t_adjlist *head;
|
char *line;
|
||||||
} t_adj;
|
struct s_rdata *next;
|
||||||
|
} t_rdata;
|
||||||
|
|
||||||
typedef struct s_graph
|
int lm_error_exit(void);
|
||||||
{
|
|
||||||
int v;
|
|
||||||
t_adj *array;
|
|
||||||
} t_graph;
|
|
||||||
|
|
||||||
typedef struct s_neighbour
|
|
||||||
{
|
|
||||||
int vertnum;
|
|
||||||
struct s_neighbor *next;
|
|
||||||
} t_neighbor;
|
|
||||||
|
|
||||||
//MT-FUNCTIONS
|
|
||||||
int lm_error_exit(int flag);
|
|
||||||
int lm_validate(t_syntax *synt, t_lmdata *lmdata);
|
int lm_validate(t_syntax *synt, t_lmdata *lmdata);
|
||||||
void lm_parser(int fd, t_syntax *synt, t_lmdata *ldata,
|
int lm_parser(t_syntax *synt, t_lmdata *ldata
|
||||||
t_holder *holder);
|
, t_holder *holder);
|
||||||
int lm_check_room_before(char **tab, t_syntax *synt);
|
int lm_check_room_before(char **tab, t_syntax *synt);
|
||||||
void lm_init_data(t_syntax *synt, t_lmdata *ldata, t_holder *holder);
|
void lm_clear_unv(t_holder *holder);
|
||||||
int lm_add_vertex(t_lmdata *ldata, char *raw, char flag, t_syntax *synt);
|
int lm_add_vertex(t_lmdata *ldata, char *raw, char flag
|
||||||
t_adjlist *lm_new_node(int dest);
|
, t_syntax *synt);
|
||||||
t_graph *lm_creategraph(int v);
|
int lm_ext_conn(t_holder *holder, t_lmdata *data
|
||||||
void lm_add_edge(t_graph *graph, int src, int dest);
|
, char *raw);
|
||||||
int lm_ext_conn(t_holder *holder, t_lmdata *data, char *raw);
|
|
||||||
int lm_find_index(t_lmdata *data, char *str);
|
int lm_find_index(t_lmdata *data, char *str);
|
||||||
|
|
||||||
|
int lm_get_value(char *line);
|
||||||
|
void lm_get_cmd_vert(int count, t_syntax *synt
|
||||||
|
, t_lmdata *ldata, char *line);
|
||||||
|
void lm_get_vert_link(int count, t_syntax *synt
|
||||||
|
, t_lmdata *ldata, t_holder *holder
|
||||||
|
, char *line);
|
||||||
|
int lm_validate_rooms(char *name, char *x, char *y);
|
||||||
|
int lm_adj_parser(t_lmdata *lmdata, t_holder *holder);
|
||||||
|
void lm_init_data(t_syntax *synt, t_holder *holder
|
||||||
|
, t_lmdata *ldata);
|
||||||
|
int lm_verify_cmd(t_syntax *synt, t_holder *holder
|
||||||
|
, t_lmdata *data);
|
||||||
void lm_initdata(t_lmdata *data);
|
void lm_initdata(t_lmdata *data);
|
||||||
int lm_getparams(t_lmdata *data);
|
int lm_getparams(t_lmdata *data);
|
||||||
|
void lm_clean_data(t_lmdata *data);
|
||||||
|
int lm_check_forbiden_chars(char *line, int flag);
|
||||||
|
t_ind **lst_indinit(t_lmdata *data);
|
||||||
|
int lst_indadd_link(t_lmdata *data, int n1, int n2);
|
||||||
t_ind *lst_indadd(t_ind **lst, int ind);
|
t_ind *lst_indadd(t_ind **lst, int ind);
|
||||||
void lst_inddel(t_ind **lst);
|
void lst_inddel(t_ind **lst);
|
||||||
|
void tablst_inddel(t_ind **tab);
|
||||||
|
|
||||||
void bfs(t_lmdata *data, t_bfs *tab, int start_ind, int end_ind);
|
t_ants *add_ant(t_ants **ants, int nb_ant, int nb_path
|
||||||
t_ind **edmunds_karp(t_lmdata *data, int start_ind, int end_ind);
|
, t_ind **paths);
|
||||||
|
void del_ants(t_ants **ants);
|
||||||
|
t_node *get_node(t_lmdata *data, int index);
|
||||||
|
t_ind *get_node_path(t_ind *lst, int index);
|
||||||
|
|
||||||
|
void bfs(t_lmdata *data, t_bfs *tab, int start_ind
|
||||||
|
, int end_ind);
|
||||||
|
t_ind **edmonds_karp(t_lmdata *data, int s_ind, int e_ind);
|
||||||
|
int get_score(t_lmdata *data, t_ind **ret, int nb_paths);
|
||||||
|
void print_paths(t_lmdata *data, t_ind **ret);
|
||||||
|
int push_ants(t_lmdata *data, t_ind **paths
|
||||||
|
, int nb_paths);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
1
libft
1
libft
Submodule libft deleted from 51295179f3
@@ -6,12 +6,12 @@
|
|||||||
# By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ #
|
# By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2018/04/07 12:47:06 by tmaze #+# #+# #
|
# Created: 2018/04/07 12:47:06 by tmaze #+# #+# #
|
||||||
# Updated: 2019/03/27 17:46:28 by tmaze ### ########.fr #
|
# Updated: 2019/04/18 09:18:00 by tmaze ### ########.fr #
|
||||||
# #
|
# #
|
||||||
#******************************************************************************#
|
#******************************************************************************#
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CCFLAGS = -Wall -Werror -Wextra -g -O0 -fsanitize=address
|
CCFLAGS = -Wall -Werror -Wextra
|
||||||
CCSTD =
|
CCSTD =
|
||||||
|
|
||||||
NAME = libft.a
|
NAME = libft.a
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user