From 1aa695c85aeeda7fd5266c05cf97a10f1edf9de9 Mon Sep 17 00:00:00 2001 From: Hugo LAMY Date: Mon, 3 Jun 2019 22:01:27 +0200 Subject: [PATCH] mise a la racine des sous dossiers de libt --- Makefile | 35 +- fillit.dSYM/Contents/Info.plist | 20 - fillit.h | 4 +- fillit_roduquen/Makefile | 34 ++ fillit_roduquen/TEST/test_11.txt | 54 +++ fillit_roduquen/TEST/test_13.txt | 64 +++ fillit_roduquen/TEST/test_7.txt | 34 ++ fillit_roduquen/TEST/test_9.txt | 44 ++ fillit_roduquen/TEST/test_I.txt | 39 ++ fillit_roduquen/TEST/test_J.txt | 119 +++++ fillit_roduquen/TEST/test_J2.txt | 119 +++++ fillit_roduquen/TEST/test_L.txt | 119 +++++ fillit_roduquen/TEST/test_O.txt | 44 ++ fillit_roduquen/TEST/test_S.txt | 59 +++ fillit_roduquen/TEST/test_T.txt | 119 +++++ fillit_roduquen/TEST/test_Z.txt | 59 +++ fillit_roduquen/TEST/test_easy.txt | 24 + fillit_roduquen/TEST/test_full_T.txt | 129 +++++ fillit_roduquen/TEST/test_ko1.txt | 39 ++ fillit_roduquen/TEST/test_ko2.txt | 40 ++ fillit_roduquen/TEST/test_ko3.txt | 38 ++ fillit_roduquen/TEST/test_ko4.txt | 39 ++ fillit_roduquen/TEST/test_ko5.txt | 40 ++ fillit_roduquen/TEST/test_ko6.txt | 39 ++ fillit_roduquen/TEST/test_ko7.txt | 39 ++ fillit_roduquen/TEST/test_no_double13.txt | 64 +++ fillit_roduquen/TEST/test_no_double16.txt | 79 +++ fillit_roduquen/TEST/test_no_double9.txt | 44 ++ fillit_roduquen/auteur | 1 + fillit_roduquen/check_count_island.c | 121 +++++ fillit_roduquen/check_count_island2.c | 31 ++ fillit_roduquen/check_hole.c | 41 ++ fillit_roduquen/check_square.c | 158 ++++++ fillit_roduquen/check_square2.c | 55 +++ fillit_roduquen/count_island.c | 126 +++++ fillit_roduquen/do_i_fillit.c | 103 ++++ fillit_roduquen/external_file.txt | 564 ++++++++++++++++++++++ fillit_roduquen/fillit.c | 127 +++++ fillit_roduquen/fillit.h | 91 ++++ fillit_roduquen/full_square.c | 148 ++++++ fillit_roduquen/full_square2.c | 38 ++ fillit_roduquen/init.c | 53 ++ fillit_roduquen/main.c | 42 ++ fillit_roduquen/remove_square.c | 46 ++ fillit_roduquen/utilitys.c | 42 ++ libft/Makefile | 239 ++------- libft/{src/tab => }/ft_any.c | 0 libft/{src/tab => }/ft_arraymap.c | 0 libft/{src/trsf => }/ft_atoi.c | 0 libft/{src/trsf => }/ft_atoibase.c | 0 libft/{src/trsf => }/ft_bzero.c | 0 libft/{src/trsf => }/ft_convertbase.c | 0 libft/{src/tab => }/ft_foreach.c | 0 libft/{src/is => }/ft_isalnum.c | 0 libft/{src/is => }/ft_isalpha.c | 0 libft/{src/is => }/ft_isascii.c | 0 libft/{src/is => }/ft_isdigit.c | 0 libft/{src/is => }/ft_isprint.c | 0 libft/{src/is => }/ft_issort.c | 0 libft/{src/trsf => }/ft_itoa.c | 0 libft/{src/lst => }/ft_lstadd.c | 0 libft/{src/lst => }/ft_lstdel.c | 0 libft/{src/lst => }/ft_lstdelone.c | 0 libft/{src/lst => }/ft_lstiter.c | 0 libft/{src/lst => }/ft_lstmap.c | 0 libft/{src/lst => }/ft_lstnew.c | 0 libft/{src/mem => }/ft_memalloc.c | 0 libft/{src/mem => }/ft_memccpy.c | 0 libft/{src/mem => }/ft_memchr.c | 0 libft/{src/mem => }/ft_memcmp.c | 0 libft/{src/mem => }/ft_memcpy.c | 0 libft/{src/mem => }/ft_memdel.c | 0 libft/{src/mem => }/ft_memmove.c | 0 libft/{src/mem => }/ft_memset.c | 0 libft/{src/put => }/ft_putchar.c | 0 libft/{src/put => }/ft_putchar_fd.c | 0 libft/{src/put => }/ft_putendl.c | 0 libft/{src/put => }/ft_putendl_fd.c | 0 libft/{src/put => }/ft_putnbr.c | 0 libft/{src/put => }/ft_putnbr_fd.c | 0 libft/{src/put => }/ft_putnbrbase.c | 0 libft/{src/put => }/ft_putnbrendl.c | 0 libft/{src/put => }/ft_putnbrendl_fd.c | 0 libft/{src/put => }/ft_putstr.c | 0 libft/{src/put => }/ft_putstr_fd.c | 0 libft/{src/str => }/ft_strcat.c | 0 libft/{src/str => }/ft_strchr.c | 0 libft/{src/str => }/ft_strclr.c | 0 libft/{src/str => }/ft_strcmp.c | 0 libft/{src/str => }/ft_strcpy.c | 0 libft/{src/str => }/ft_strdel.c | 0 libft/{src/str => }/ft_strdup.c | 0 libft/{src/str => }/ft_strequ.c | 0 libft/{src/str => }/ft_striter.c | 0 libft/{src/str => }/ft_striteri.c | 0 libft/{src/str => }/ft_strjoin.c | 0 libft/{src/str => }/ft_strjoinfree.c | 0 libft/{src/str => }/ft_strlcat.c | 0 libft/{src/str => }/ft_strlen.c | 0 libft/{src/str => }/ft_strmap.c | 0 libft/{src/str => }/ft_strmapi.c | 0 libft/{src/str => }/ft_strmultisplit.c | 0 libft/{src/str => }/ft_strncat.c | 0 libft/{src/str => }/ft_strncmp.c | 0 libft/{src/str => }/ft_strncpy.c | 0 libft/{src/str => }/ft_strnequ.c | 0 libft/{src/str => }/ft_strnew.c | 0 libft/{src/str => }/ft_strnstr.c | 0 libft/{src/str => }/ft_strrchr.c | 0 libft/{src/str => }/ft_strsplit.c | 0 libft/{src/str => }/ft_strstr.c | 0 libft/{src/str => }/ft_strsub.c | 0 libft/{src/str => }/ft_strtrim.c | 0 libft/{src/trsf => }/ft_tolower.c | 0 libft/{src/trsf => }/ft_toupper.c | 0 libft/libft.a | Bin 63720 -> 63720 bytes libft/{includes => }/libft.h | 0 main.c | 2 +- 118 files changed, 3358 insertions(+), 250 deletions(-) delete mode 100644 fillit.dSYM/Contents/Info.plist create mode 100755 fillit_roduquen/Makefile create mode 100644 fillit_roduquen/TEST/test_11.txt create mode 100644 fillit_roduquen/TEST/test_13.txt create mode 100644 fillit_roduquen/TEST/test_7.txt create mode 100644 fillit_roduquen/TEST/test_9.txt create mode 100755 fillit_roduquen/TEST/test_I.txt create mode 100755 fillit_roduquen/TEST/test_J.txt create mode 100755 fillit_roduquen/TEST/test_J2.txt create mode 100755 fillit_roduquen/TEST/test_L.txt create mode 100755 fillit_roduquen/TEST/test_O.txt create mode 100755 fillit_roduquen/TEST/test_S.txt create mode 100755 fillit_roduquen/TEST/test_T.txt create mode 100755 fillit_roduquen/TEST/test_Z.txt create mode 100644 fillit_roduquen/TEST/test_easy.txt create mode 100644 fillit_roduquen/TEST/test_full_T.txt create mode 100644 fillit_roduquen/TEST/test_ko1.txt create mode 100644 fillit_roduquen/TEST/test_ko2.txt create mode 100644 fillit_roduquen/TEST/test_ko3.txt create mode 100644 fillit_roduquen/TEST/test_ko4.txt create mode 100644 fillit_roduquen/TEST/test_ko5.txt create mode 100644 fillit_roduquen/TEST/test_ko6.txt create mode 100644 fillit_roduquen/TEST/test_ko7.txt create mode 100644 fillit_roduquen/TEST/test_no_double13.txt create mode 100644 fillit_roduquen/TEST/test_no_double16.txt create mode 100644 fillit_roduquen/TEST/test_no_double9.txt create mode 100755 fillit_roduquen/auteur create mode 100755 fillit_roduquen/check_count_island.c create mode 100755 fillit_roduquen/check_count_island2.c create mode 100755 fillit_roduquen/check_hole.c create mode 100755 fillit_roduquen/check_square.c create mode 100755 fillit_roduquen/check_square2.c create mode 100755 fillit_roduquen/count_island.c create mode 100755 fillit_roduquen/do_i_fillit.c create mode 100755 fillit_roduquen/external_file.txt create mode 100755 fillit_roduquen/fillit.c create mode 100755 fillit_roduquen/fillit.h create mode 100755 fillit_roduquen/full_square.c create mode 100755 fillit_roduquen/full_square2.c create mode 100755 fillit_roduquen/init.c create mode 100755 fillit_roduquen/main.c create mode 100755 fillit_roduquen/remove_square.c create mode 100755 fillit_roduquen/utilitys.c rename libft/{src/tab => }/ft_any.c (100%) rename libft/{src/tab => }/ft_arraymap.c (100%) rename libft/{src/trsf => }/ft_atoi.c (100%) rename libft/{src/trsf => }/ft_atoibase.c (100%) rename libft/{src/trsf => }/ft_bzero.c (100%) rename libft/{src/trsf => }/ft_convertbase.c (100%) rename libft/{src/tab => }/ft_foreach.c (100%) rename libft/{src/is => }/ft_isalnum.c (100%) rename libft/{src/is => }/ft_isalpha.c (100%) rename libft/{src/is => }/ft_isascii.c (100%) rename libft/{src/is => }/ft_isdigit.c (100%) rename libft/{src/is => }/ft_isprint.c (100%) rename libft/{src/is => }/ft_issort.c (100%) rename libft/{src/trsf => }/ft_itoa.c (100%) rename libft/{src/lst => }/ft_lstadd.c (100%) rename libft/{src/lst => }/ft_lstdel.c (100%) rename libft/{src/lst => }/ft_lstdelone.c (100%) rename libft/{src/lst => }/ft_lstiter.c (100%) rename libft/{src/lst => }/ft_lstmap.c (100%) rename libft/{src/lst => }/ft_lstnew.c (100%) rename libft/{src/mem => }/ft_memalloc.c (100%) rename libft/{src/mem => }/ft_memccpy.c (100%) rename libft/{src/mem => }/ft_memchr.c (100%) rename libft/{src/mem => }/ft_memcmp.c (100%) rename libft/{src/mem => }/ft_memcpy.c (100%) rename libft/{src/mem => }/ft_memdel.c (100%) rename libft/{src/mem => }/ft_memmove.c (100%) rename libft/{src/mem => }/ft_memset.c (100%) rename libft/{src/put => }/ft_putchar.c (100%) rename libft/{src/put => }/ft_putchar_fd.c (100%) rename libft/{src/put => }/ft_putendl.c (100%) rename libft/{src/put => }/ft_putendl_fd.c (100%) rename libft/{src/put => }/ft_putnbr.c (100%) rename libft/{src/put => }/ft_putnbr_fd.c (100%) rename libft/{src/put => }/ft_putnbrbase.c (100%) rename libft/{src/put => }/ft_putnbrendl.c (100%) rename libft/{src/put => }/ft_putnbrendl_fd.c (100%) rename libft/{src/put => }/ft_putstr.c (100%) rename libft/{src/put => }/ft_putstr_fd.c (100%) rename libft/{src/str => }/ft_strcat.c (100%) rename libft/{src/str => }/ft_strchr.c (100%) rename libft/{src/str => }/ft_strclr.c (100%) rename libft/{src/str => }/ft_strcmp.c (100%) rename libft/{src/str => }/ft_strcpy.c (100%) rename libft/{src/str => }/ft_strdel.c (100%) rename libft/{src/str => }/ft_strdup.c (100%) rename libft/{src/str => }/ft_strequ.c (100%) rename libft/{src/str => }/ft_striter.c (100%) rename libft/{src/str => }/ft_striteri.c (100%) rename libft/{src/str => }/ft_strjoin.c (100%) rename libft/{src/str => }/ft_strjoinfree.c (100%) rename libft/{src/str => }/ft_strlcat.c (100%) rename libft/{src/str => }/ft_strlen.c (100%) rename libft/{src/str => }/ft_strmap.c (100%) rename libft/{src/str => }/ft_strmapi.c (100%) rename libft/{src/str => }/ft_strmultisplit.c (100%) rename libft/{src/str => }/ft_strncat.c (100%) rename libft/{src/str => }/ft_strncmp.c (100%) rename libft/{src/str => }/ft_strncpy.c (100%) rename libft/{src/str => }/ft_strnequ.c (100%) rename libft/{src/str => }/ft_strnew.c (100%) rename libft/{src/str => }/ft_strnstr.c (100%) rename libft/{src/str => }/ft_strrchr.c (100%) rename libft/{src/str => }/ft_strsplit.c (100%) rename libft/{src/str => }/ft_strstr.c (100%) rename libft/{src/str => }/ft_strsub.c (100%) rename libft/{src/str => }/ft_strtrim.c (100%) rename libft/{src/trsf => }/ft_tolower.c (100%) rename libft/{src/trsf => }/ft_toupper.c (100%) rename libft/{includes => }/libft.h (100%) diff --git a/Makefile b/Makefile index e760aa6..a699ea4 100644 --- a/Makefile +++ b/Makefile @@ -6,14 +6,10 @@ # By: vmanzoni +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2019/03/01 13:24:35 by vmanzoni #+# #+# # -# Updated: 2019/06/01 16:57:51 by hulamy ### ########.fr # +# Updated: 2019/06/03 21:55:31 by hulamy ### ########.fr # # # # **************************************************************************** # -# - - - - - - - - - - - - - - - # -# VARIABLES # -# - - - - - - - - - - - - - - - # - NAME = fillit CC = gcc @@ -23,13 +19,17 @@ CFLAGS += -Wall -Wextra -Werror LDFLAGS = -L./libft/ LDLIBS = -lft -SRCS = $(shell find . -depth 1 -type f -not -name '.*' -not -name 'test*' -name '*.c') +SRCS = main.c \ + f_bonus_opti.c \ + f_bonus_print.c \ + f_handle_errors.c \ + f_parse_input.c \ + f_print.c \ + f_print_map_with_colors.c \ + f_read_file.c \ + f_search_map.c -TRASH = $(shell find . -depth 1 -name '*.dSYM') -TRASH += $(shell find . -depth 1 -type f -name '*.o') -TRASH += $(shell find . -depth 1 -type f -name '*.swp') -TRASH += $(shell find . -depth 1 -type f -name '*.swo') -TRASH += $(shell find . -depth 1 -type f -name '*.swn') +OBJS = $(SRCS:.c=.o) # - - - - - - - - - - - - - - - # # RULES # @@ -37,19 +37,16 @@ TRASH += $(shell find . -depth 1 -type f -name '*.swn') all: $(NAME) -$(NAME): $(SRCS) +$(NAME): $(OBJS) + make -C ./libft/ $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(SRCS) -o $(NAME) -debug: $(SRCS) - $(CC) -g $(CFLAGS) $(LDFLAGS) $(LDLIBS) $(SRCS) -o $(NAME) - -lib: - make -C ./libft/ - clean: - /bin/rm -rf $(TRASH) + make clean -C libft/ + /bin/rm -rf $(OBJS) fclean: clean + make fclean -C libft/ /bin/rm -rf $(NAME) re: fclean all diff --git a/fillit.dSYM/Contents/Info.plist b/fillit.dSYM/Contents/Info.plist deleted file mode 100644 index 96bfe2d..0000000 --- a/fillit.dSYM/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.fillit - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/fillit.h b/fillit.h index 1f61ed3..35cde4f 100644 --- a/fillit.h +++ b/fillit.h @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */ -/* Updated: 2019/06/01 15:12:00 by hulamy ### ########.fr */ +/* Updated: 2019/06/03 21:53:09 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,7 +18,7 @@ # include # include -# include "libft/includes/libft.h" +# include "libft/libft.h" /* ** DEFINE diff --git a/fillit_roduquen/Makefile b/fillit_roduquen/Makefile new file mode 100755 index 0000000..1906200 --- /dev/null +++ b/fillit_roduquen/Makefile @@ -0,0 +1,34 @@ +CC = gcc +CFLAGS = -Wall -Wextra -Werror +NAME = fillit +SRCDIR = ./ +INCLDIR = ./ +SRCS = $(SRCDIR)main.c $(SRCDIR)check_square.c $(SRCDIR)check_square2.c \ + $(SRCDIR)fillit.c $(SRCDIR)full_square.c $(SRCDIR)check_hole.c\ + $(SRCDIR)full_square2.c $(SRCDIR)remove_square.c $(SRCDIR)utilitys.c \ + $(SRCDIR)do_i_fillit.c $(SRCDIR)count_island.c \ + $(SRCDIR)check_count_island.c $(SRCDIR)init.c \ + $(SRCDIR)check_count_island2.c +OBJS_ = $(SRCS:.c=.o) +OBJS = $(notdir $(OBJS_)) + +all : $(NAME) + +$(NAME) : $(SRCS) + @make $(OBJS) + @$(CC) $(CFLAGS) -I $(INCLDIR) $^ -o $@ + @echo "\n\033[36mCreation :\033[0m \033[35;4m$(NAME)\033[0m\n" + +%.o : %.c + @$(CC) $(CFLAGS) -c -I $(INCLDIR) $^ + @echo "\033[36mCompilation :\033[0m \033[32m$*\033[0m" + +clean : + @rm -rf $(OBJS) + @echo "\n\033[36mDeletion :\033[0m \033[32mObjects\033[0m\n" + +fclean : clean + @rm -rf $(NAME) + @echo "\033[36mDeletion :\033[0m \033[35;4m$(NAME)\033[0m\n" + +re : fclean all diff --git a/fillit_roduquen/TEST/test_11.txt b/fillit_roduquen/TEST/test_11.txt new file mode 100644 index 0000000..0dfe420 --- /dev/null +++ b/fillit_roduquen/TEST/test_11.txt @@ -0,0 +1,54 @@ +..#. +###. +.... +.... + +..## +.##. +.... +.... + +.#.. +###. +.... +.... + +.#.. +##.. +.#.. +.... + +.### +...# +.... +.... + +.... +.... +.... +#### + +.... +.##. +.##. +.... + +.#.. +.##. +.#.. +.... + +.#.. +.#.. +.##. +.... + +.### +..#. +.... +.... + +.#.. +###. +.... +.... diff --git a/fillit_roduquen/TEST/test_13.txt b/fillit_roduquen/TEST/test_13.txt new file mode 100644 index 0000000..fafb8c2 --- /dev/null +++ b/fillit_roduquen/TEST/test_13.txt @@ -0,0 +1,64 @@ +..#. +###. +.... +.... + +..## +.##. +.... +.... + +.#.. +###. +.... +.... + +.#.. +##.. +.#.. +.... + +.### +...# +.... +.... + +.... +.... +.... +#### + +.... +.##. +.##. +.... + +.#.. +.##. +.#.. +.... + +.#.. +.#.. +.##. +.... + +.### +..#. +.... +.... + +.#.. +###. +.... +.... + +.... +.#.. +###. +.... + +..## +.##. +.... +.... diff --git a/fillit_roduquen/TEST/test_7.txt b/fillit_roduquen/TEST/test_7.txt new file mode 100644 index 0000000..03e3846 --- /dev/null +++ b/fillit_roduquen/TEST/test_7.txt @@ -0,0 +1,34 @@ +..#. +###. +.... +.... + +..## +.##. +.... +.... + +.#.. +###. +.... +.... + +.#.. +##.. +.#.. +.... + +.### +...# +.... +.... + +.... +.... +.... +#### + +.... +.##. +.##. +.... diff --git a/fillit_roduquen/TEST/test_9.txt b/fillit_roduquen/TEST/test_9.txt new file mode 100644 index 0000000..1ab4b6c --- /dev/null +++ b/fillit_roduquen/TEST/test_9.txt @@ -0,0 +1,44 @@ +..#. +###. +.... +.... + +..## +.##. +.... +.... + +.#.. +###. +.... +.... + +.#.. +##.. +.#.. +.... + +.### +...# +.... +.... + +.... +.... +.... +#### + +.... +.##. +.##. +.... + +.#.. +.##. +.#.. +.... + +.#.. +.#.. +.##. +.... diff --git a/fillit_roduquen/TEST/test_I.txt b/fillit_roduquen/TEST/test_I.txt new file mode 100755 index 0000000..1b30608 --- /dev/null +++ b/fillit_roduquen/TEST/test_I.txt @@ -0,0 +1,39 @@ +#### +.... +.... +.... + +.... +#### +.... +.... + +.... +.... +#### +.... + +.... +.... +.... +#### + +#... +#... +#... +#... + +.#.. +.#.. +.#.. +.#.. + +..#. +..#. +..#. +..#. + +...# +...# +...# +...# diff --git a/fillit_roduquen/TEST/test_J.txt b/fillit_roduquen/TEST/test_J.txt new file mode 100755 index 0000000..bba6560 --- /dev/null +++ b/fillit_roduquen/TEST/test_J.txt @@ -0,0 +1,119 @@ +.#.. +.#.. +##.. +.... + +..#. +..#. +.##. +.... + +...# +...# +..## +.... + +.... +.#.. +.#.. +##.. + +.... +..#. +..#. +.##. + +.... +...# +...# +..## + +###. +..#. +.... +.... + +.### +...# +.... +.... + +.... +###. +..#. +.... + +.... +.### +...# +.... + +.... +.... +###. +..#. + +.... +.... +.### +...# + +##.. +#... +#... +.... + +.##. +.#.. +.#.. +.... + +..## +..#. +..#. +.... + +.... +##.. +#... +#... + +.... +.##. +.#.. +.#.. + +.... +..## +..#. +..#. + +#... +###. +.... +.... + +.#.. +.### +.... +.... + +.... +#... +###. +.... + +.... +.#.. +.### +.... + +.... +.... +#... +###. + +.... +.... +.#.. +.### diff --git a/fillit_roduquen/TEST/test_J2.txt b/fillit_roduquen/TEST/test_J2.txt new file mode 100755 index 0000000..139fe80 --- /dev/null +++ b/fillit_roduquen/TEST/test_J2.txt @@ -0,0 +1,119 @@ +..## +..#. +..#. +.... + +.... +##.. +#... +#... + +.... +.##. +.#.. +.#.. + +.... +..## +..#. +..#. + +.#.. +.#.. +##.. +.... + +..#. +..#. +.##. +.... + +...# +...# +..## +.... + +.... +.#.. +.#.. +##.. + +.... +..#. +..#. +.##. + +.... +...# +...# +..## + +###. +..#. +.... +.... + +.### +...# +.... +.... + +.... +###. +..#. +.... + +.... +.### +...# +.... + +.... +.... +###. +..#. + +.... +.... +.### +...# + +##.. +#... +#... +.... + +.##. +.#.. +.#.. +.... + +#... +###. +.... +.... + +.#.. +.### +.... +.... + +.... +#... +###. +.... + +.... +.#.. +.### +.... + +.... +.... +#... +###. + +.... +.... +.#.. +.### diff --git a/fillit_roduquen/TEST/test_L.txt b/fillit_roduquen/TEST/test_L.txt new file mode 100755 index 0000000..6c2f3f1 --- /dev/null +++ b/fillit_roduquen/TEST/test_L.txt @@ -0,0 +1,119 @@ +#... +#... +##.. +.... + +.#.. +.#.. +.##. +.... + +..#. +..#. +..## +.... + +.... +#... +#... +##.. + +.... +.#.. +.#.. +.##. + +.... +..#. +..#. +..## + +###. +#... +.... +.... + +.### +.#.. +.... +.... + +.... +###. +#... +.... + +.... +.### +.#.. +.... + +.... +.... +###. +#... + +.... +.... +.### +.#.. + +##.. +.#.. +.#.. +.... + +.##. +..#. +..#. +.... + +..## +...# +...# +.... + +.... +##.. +.#.. +.#.. + +.... +.##. +..#. +..#. + +.... +..## +...# +...# + +..#. +###. +.... +.... + +...# +.### +.... +.... + +.... +..#. +###. +.... + +.... +...# +.### +.... + +.... +.... +..#. +###. + +.... +.... +...# +.### diff --git a/fillit_roduquen/TEST/test_O.txt b/fillit_roduquen/TEST/test_O.txt new file mode 100755 index 0000000..78d0f8e --- /dev/null +++ b/fillit_roduquen/TEST/test_O.txt @@ -0,0 +1,44 @@ +##.. +##.. +.... +.... + +.##. +.##. +.... +.... + +..## +..## +.... +.... + +.... +##.. +##.. +.... + +.... +.##. +.##. +.... + +.... +..## +..## +.... + +.... +.... +##.. +##.. + +.... +.... +.##. +.##. + +.... +.... +..## +..## diff --git a/fillit_roduquen/TEST/test_S.txt b/fillit_roduquen/TEST/test_S.txt new file mode 100755 index 0000000..a87060c --- /dev/null +++ b/fillit_roduquen/TEST/test_S.txt @@ -0,0 +1,59 @@ +.##. +##.. +.... +.... + +..## +.##. +.... +.... + +.... +.##. +##.. +.... + +.... +..## +.##. +.... + +.... +.... +.##. +##.. + +.... +.... +..## +.##. + +#... +##.. +.#.. +.... + +.#.. +.##. +..#. +.... + +..#. +..## +...# +.... + +.... +#... +##.. +.#.. + +.... +.#.. +.##. +..#. + +.... +..#. +..## +...# diff --git a/fillit_roduquen/TEST/test_T.txt b/fillit_roduquen/TEST/test_T.txt new file mode 100755 index 0000000..76f0188 --- /dev/null +++ b/fillit_roduquen/TEST/test_T.txt @@ -0,0 +1,119 @@ +###. +.#.. +.... +.... + +.### +..#. +.... +.... + +.... +###. +.#.. +.... + +.... +.### +..#. +.... + +.... +.... +###. +.#.. + +.... +.... +.### +..#. + +#... +##.. +#... +.... + +.#.. +.##. +.#.. +.... + +..#. +..## +..#. +.... + +.... +#... +##.. +#... + +.... +.#.. +.##. +.#.. + +.... +..#. +..## +..#. + +.#.. +###. +.... +.... + +..#. +.### +.... +.... + +.... +.#.. +###. +.... + +.... +..#. +.### +.... + +.... +.... +.#.. +###. + +.... +.... +..#. +.### + +.#.. +##.. +.#.. +.... + +..#. +.##. +..#. +.... + +...# +..## +...# +.... + +.... +.#.. +##.. +.#.. + +.... +..#. +.##. +..#. + +.... +...# +..## +...# diff --git a/fillit_roduquen/TEST/test_Z.txt b/fillit_roduquen/TEST/test_Z.txt new file mode 100755 index 0000000..0e10fa8 --- /dev/null +++ b/fillit_roduquen/TEST/test_Z.txt @@ -0,0 +1,59 @@ +##.. +.##. +.... +.... + +.##. +..## +.... +.... + +.... +##.. +.##. +.... + +.... +.##. +..## +.... + +.... +.... +##.. +.##. + +.... +.... +.##. +..## + +.#.. +##.. +#... +.... + +..#. +.##. +.#.. +.... + +...# +..## +..#. +.... + +.... +.#.. +##.. +#... + +.... +..#. +.##. +.#.. + +.... +...# +..## +..#. diff --git a/fillit_roduquen/TEST/test_easy.txt b/fillit_roduquen/TEST/test_easy.txt new file mode 100644 index 0000000..61d5f10 --- /dev/null +++ b/fillit_roduquen/TEST/test_easy.txt @@ -0,0 +1,24 @@ +..#. +###. +.... +.... + +..## +.##. +.... +.... + +.#.. +###. +.... +.... + +.#.. +##.. +.#.. +.... + +.### +...# +.... +.... diff --git a/fillit_roduquen/TEST/test_full_T.txt b/fillit_roduquen/TEST/test_full_T.txt new file mode 100644 index 0000000..6f82359 --- /dev/null +++ b/fillit_roduquen/TEST/test_full_T.txt @@ -0,0 +1,129 @@ +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... + +.#.. +###. +.... +.... diff --git a/fillit_roduquen/TEST/test_ko1.txt b/fillit_roduquen/TEST/test_ko1.txt new file mode 100644 index 0000000..cd2ba13 --- /dev/null +++ b/fillit_roduquen/TEST/test_ko1.txt @@ -0,0 +1,39 @@ +#### +.... +.... +.... + +.... +#### +.... +.... + +.... +.... +#### +.... + +.... +.... +.... +#### + +#... +#... +#... +#... + +.#.. +.#.. +.#.. +.#.. + +..#. +..#. +..#. +..#. + +...# +...# +...# +...#. diff --git a/fillit_roduquen/TEST/test_ko2.txt b/fillit_roduquen/TEST/test_ko2.txt new file mode 100644 index 0000000..a75e115 --- /dev/null +++ b/fillit_roduquen/TEST/test_ko2.txt @@ -0,0 +1,40 @@ +#### +.... +.... +.... + +.... +#### +.... +.... + +.... +.... +#### +.... + +.... +.... +.... +#### + +#... +#... +#... +#... + +.#.. +.#.. +.#.. +.#.. + +..#. +..#. +..#. +..#. + +...# +...# +...# +...# + diff --git a/fillit_roduquen/TEST/test_ko3.txt b/fillit_roduquen/TEST/test_ko3.txt new file mode 100644 index 0000000..2cadd6e --- /dev/null +++ b/fillit_roduquen/TEST/test_ko3.txt @@ -0,0 +1,38 @@ +#### +.... +.... +.... + +.... +#### +.... +.... + +.... +.... +#### +.... + +.... +.... +.... +#### + +#... +#... +#... +#... + +.#.. +.#.. +.#.. +.#.. + +..#. +..#. +..#. +..#. +...# +...# +...# +...# diff --git a/fillit_roduquen/TEST/test_ko4.txt b/fillit_roduquen/TEST/test_ko4.txt new file mode 100644 index 0000000..0772827 --- /dev/null +++ b/fillit_roduquen/TEST/test_ko4.txt @@ -0,0 +1,39 @@ +#### +.... +.... +.... + +.... +#### +.... +.... + +.... +.... +#### +.... + +.... +.... +.... +#### + +#... +#... +#... +#... + +.#.. +.#.. +.#.. +.#.. + +..#. +..#. +..#. +..#. + +...# +..## +...# +...# diff --git a/fillit_roduquen/TEST/test_ko5.txt b/fillit_roduquen/TEST/test_ko5.txt new file mode 100644 index 0000000..9fa78dc --- /dev/null +++ b/fillit_roduquen/TEST/test_ko5.txt @@ -0,0 +1,40 @@ +#### +.... +.... +.... + +.... +#### +.... +.... + +.... +.... +#### +.... + +.... +.... +.... +#### + + +#... +#... +#... +#... + +.#.. +.#.. +.#.. +.#.. + +..#. +..#. +..#. +..#. + +...# +...# +...# +...#. diff --git a/fillit_roduquen/TEST/test_ko6.txt b/fillit_roduquen/TEST/test_ko6.txt new file mode 100644 index 0000000..6e1c36a --- /dev/null +++ b/fillit_roduquen/TEST/test_ko6.txt @@ -0,0 +1,39 @@ +#### +.... +.... +.... + +.... +#### +.... +.... + +.... +.... +#### +.... + +.... +.... +.... +#### + +#... +.... +#... +#... + +.#.. +.#.. +.#.. +.#.. + +..#. +..#. +..#. +..#. + +...# +...# +...# +...#. diff --git a/fillit_roduquen/TEST/test_ko7.txt b/fillit_roduquen/TEST/test_ko7.txt new file mode 100644 index 0000000..cd2ba13 --- /dev/null +++ b/fillit_roduquen/TEST/test_ko7.txt @@ -0,0 +1,39 @@ +#### +.... +.... +.... + +.... +#### +.... +.... + +.... +.... +#### +.... + +.... +.... +.... +#### + +#... +#... +#... +#... + +.#.. +.#.. +.#.. +.#.. + +..#. +..#. +..#. +..#. + +...# +...# +...# +...#. diff --git a/fillit_roduquen/TEST/test_no_double13.txt b/fillit_roduquen/TEST/test_no_double13.txt new file mode 100644 index 0000000..c0c219c --- /dev/null +++ b/fillit_roduquen/TEST/test_no_double13.txt @@ -0,0 +1,64 @@ +.... +#### +.... +.... + +#... +#... +#... +#... + +.#.. +###. +.... +.... + +.#.. +.##. +.#.. +.... + +.### +..#. +.... +.... + +###. +..#. +.... +.... + +.### +.#.. +.... +.... + +##.. +##.. +.... +.... + +.#.. +.#.. +.##. +.... + +.#.. +##.. +.#.. +.... + +.#.. +.#.. +##.. +.... + +...# +.### +.... +.... + +.#.. +.### +.... +.... diff --git a/fillit_roduquen/TEST/test_no_double16.txt b/fillit_roduquen/TEST/test_no_double16.txt new file mode 100644 index 0000000..44dd29c --- /dev/null +++ b/fillit_roduquen/TEST/test_no_double16.txt @@ -0,0 +1,79 @@ +.... +#### +.... +.... + +#... +#... +#... +#... + +.#.. +###. +.... +.... + +.#.. +.##. +.#.. +.... + +.### +..#. +.... +.... + +###. +..#. +.... +.... + +.### +.#.. +.... +.... + +##.. +##.. +.... +.... + +.#.. +.#.. +.##. +.... + +.#.. +##.. +.#.. +.... + +.#.. +.#.. +##.. +.... + +...# +.### +.... +.... + +.#.. +.### +.... +.... + +##.. +.#.. +.#.. +.... + +##.. +#... +#... +.... + +.##. +##.. +.... +.... diff --git a/fillit_roduquen/TEST/test_no_double9.txt b/fillit_roduquen/TEST/test_no_double9.txt new file mode 100644 index 0000000..98c961c --- /dev/null +++ b/fillit_roduquen/TEST/test_no_double9.txt @@ -0,0 +1,44 @@ +.... +#### +.... +.... + +#... +#... +#... +#... + +.#.. +###. +.... +.... + +.#.. +.##. +.#.. +.... + +.### +..#. +.... +.... + +###. +..#. +.... +.... + +.### +.#.. +.... +.... + +##.. +##.. +.... +.... + +.#.. +.#.. +.##. +.... diff --git a/fillit_roduquen/auteur b/fillit_roduquen/auteur new file mode 100755 index 0000000..12d456b --- /dev/null +++ b/fillit_roduquen/auteur @@ -0,0 +1 @@ +roduquen;scarpent diff --git a/fillit_roduquen/check_count_island.c b/fillit_roduquen/check_count_island.c new file mode 100755 index 0000000..96115ce --- /dev/null +++ b/fillit_roduquen/check_count_island.c @@ -0,0 +1,121 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* check_count_island.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:04 by roduquen #+# #+# */ +/* Updated: 2019/04/01 19:16:13 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" + +int ft_check_square(int i, t_type *square, char nbr) +{ + if (i < square->size) + { + if (i == 0) + { + if ((square->isl[i + 1] == nbr && (i + 1) % square->size != 0) + || square->isl[i + square->size] == nbr) + { + square->isl[i] = nbr; + if (square->str[i + 1] == '.' && (i + 1) % square->size != 0) + square->isl[i + 1] = nbr; + if (square->str[i + square->size] == '.') + square->isl[i + square->size] = nbr; + return (SUCCESS); + } + return (ERROR); + } + else + return (ft_check_square2(i, square, nbr)); + } + return (ft_check_square3(i, square, nbr)); +} + +int ft_check_square2(int i, t_type *square, char nbr) +{ + if ((square->isl[i + 1] == nbr && (i + 1) % square->size != 0) + || square->isl[i - 1] == nbr + || square->isl[i + square->size] == nbr) + { + square->isl[i] = nbr; + if (square->str[i + 1] == '.' && (i + 1) % square->size != 0) + square->isl[i + 1] = nbr; + if (square->str[i - 1] == '.') + square->isl[i - 1] = nbr; + if (square->str[i + square->size] == '.') + square->isl[i + square->size] = nbr; + return (SUCCESS); + } + return (ERROR); +} + +int ft_check_square3(int i, t_type *square, char nbr) +{ + if (i < square->size * (square->size - 1)) + { + if (i % square->size == 0) + { + if ((square->isl[i + 1] == nbr && (i + 1) % square->size != 0) + || square->isl[i + square->size] == nbr + || square->isl[i - square->size] == nbr) + { + square->isl[i] = nbr; + if (square->str[i + 1] == '.') + square->isl[i + 1] = nbr; + if (square->str[i + square->size] == '.') + square->isl[i + square->size] = nbr; + if (square->str[i - square->size] == '.') + square->isl[i - square->size] = nbr; + return (SUCCESS); + } + return (ERROR); + } + else + return (ft_check_square4(i, square, nbr)); + } + return (ft_check_square5(i, square, nbr)); +} + +int ft_check_square4(int i, t_type *square, char nbr) +{ + if ((square->isl[i + 1] == nbr && (i + 1) % square->size != 0) + || square->isl[i + square->size] == nbr + || square->isl[i - 1] == nbr || square->isl[i - square->size] == nbr) + { + square->isl[i] = nbr; + if (square->str[i + 1] == '.' && (i + 1) % square->size != 0) + square->isl[i + 1] = nbr; + if (square->str[i + square->size] == '.') + square->isl[i + square->size] = nbr; + if (square->str[i - 1] == '.') + square->isl[i - 1] = nbr; + if (square->str[i - square->size] == '.') + square->isl[i - square->size] = nbr; + return (SUCCESS); + } + return (ERROR); +} + +int ft_check_square5(int i, t_type *square, char nbr) +{ + if (i % square->size == 0) + { + if ((square->isl[i + 1] == nbr && (i + 1) % square->size != 0) + || square->isl[i - square->size] == nbr) + { + square->isl[i] = nbr; + if (square->str[i + 1] == '.' && (i + 1) % square->size != 0) + square->isl[i + 1] = nbr; + if (square->str[i - square->size] == '.') + square->isl[i - square->size] = nbr; + return (SUCCESS); + } + return (ERROR); + } + return (ft_check_square6(i, square, nbr)); +} diff --git a/fillit_roduquen/check_count_island2.c b/fillit_roduquen/check_count_island2.c new file mode 100755 index 0000000..d851592 --- /dev/null +++ b/fillit_roduquen/check_count_island2.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* check_count_island.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:04 by roduquen #+# #+# */ +/* Updated: 2019/04/01 19:15:21 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" + +int ft_check_square6(int i, t_type *square, char nbr) +{ + if ((square->isl[i + 1] == nbr && (i + 1) % square->size != 0) + || square->isl[i - square->size] == nbr + || square->isl[i - 1] == nbr) + { + square->isl[i] = nbr; + if (square->str[i + 1] == '.' && (i + 1) % square->size != 0) + square->isl[i + 1] = nbr; + if (square->str[i - square->size] == '.') + square->isl[i - square->size] = nbr; + if (square->str[i - 1] == '.') + square->isl[i - 1] = nbr; + return (SUCCESS); + } + return (ERROR); +} diff --git a/fillit_roduquen/check_hole.c b/fillit_roduquen/check_hole.c new file mode 100755 index 0000000..cd340a3 --- /dev/null +++ b/fillit_roduquen/check_hole.c @@ -0,0 +1,41 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* check_hole.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:10 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:12:11 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" + +int check_hole(t_type *square, char tetri[], int to_test) +{ + if (count_island(square, 0, tetri, to_test) > square->hole) + return (ERROR); + return (SUCCESS); +} + +int i_fillit_the_power(t_type *square, char tetri[], int pos) +{ + int i; + int j; + + i = 0; + j = -1; + while (i < pos) + { + if (tetri[i] == tetri[pos]) + j = i; + i++; + } + if (j == -1) + return (0); + i = 0; + while (square->str[i] != j + 'A') + i++; + return (i); +} diff --git a/fillit_roduquen/check_square.c b/fillit_roduquen/check_square.c new file mode 100755 index 0000000..4e133bd --- /dev/null +++ b/fillit_roduquen/check_square.c @@ -0,0 +1,158 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* check_square.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:12 by roduquen #+# #+# */ +/* Updated: 2019/04/01 19:14:13 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" +#include +#include + +int check_square(t_type *square, char tetri, int pos) +{ + if (tetri == -9 + && square->str[pos] == '.' && (pos + 1) % square->size != 0 + && pos + 2 * square->size + 1 < square->size * square->size + && square->str[pos + 1] == '.' + && square->str[pos + square->size + 1] == '.' + && square->str[pos + 2 * square->size + 1] == '.') + return (SUCCESS); + if (tetri == -8 + && (pos + 1) % square->size != 0 + && pos + 2 * square->size + 1 < square->size * square->size + && square->str[pos + 1] == '.' + && square->str[pos + 2 * square->size] == '.' + && square->str[pos + square->size + 1] == '.' + && square->str[pos + 2 * square->size + 1] == '.') + return (SUCCESS); + if (tetri == -7 + && (pos + 1) % square->size != 0 + && pos + 2 * square->size < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 1] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 * square->size] == '.') + return (SUCCESS); + return (check_square2(square, tetri, pos)); +} + +int check_square2(t_type *square, char tetri, int pos) +{ + if (tetri == -6 + && (pos + 1) % square->size != 0 + && pos + 2 * square->size + 1 < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 2 * square->size + 1] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 * square->size] == '.') + return (SUCCESS); + if (tetri == -5 + && (pos + 1) % square->size != 0 && (pos + 2) % square->size != 0 + && pos + square->size + 1 < square->size * square->size + && square->str[pos + 1] == '.' + && square->str[pos + 2] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 1 + square->size] == '.') + return (SUCCESS); + if (tetri == -4 + && (pos + 1) % square->size != 0 && (pos + 2) % square->size != 0 + && pos + 2 + square->size < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 1] == '.' + && square->str[pos + square->size + 1] == '.' + && square->str[pos + 2 + square->size] == '.') + return (SUCCESS); + return (check_square3(square, tetri, pos)); +} + +int check_square3(t_type *square, char tetri, int pos) +{ + if (tetri == -3 + && (pos + 1) % square->size != 0 + && pos + 2 * square->size < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 1 + square->size] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 * square->size] == '.') + return (SUCCESS); + if (tetri == -2 + && (pos + 1) % square->size != 0 + && pos + 2 * square->size + 1 < square->size * square->size + && square->str[pos + 1] == '.' + && square->str[pos + 1 + square->size] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 * square->size + 1] == '.') + return (SUCCESS); + if (tetri == -1 + && (pos + 1) % square->size != 0 && (pos + 2) % square->size != 0 + && (pos + 3) % square->size != 0 + && pos + 3 < square->size * square->size + && square->str[pos] == '.' && square->str[pos + 1] == '.' + && square->str[pos + 3] == '.' + && square->str[pos + 2] == '.') + return (SUCCESS); + return (check_square4(square, tetri, pos)); +} + +int check_square4(t_type *square, char tetri, int pos) +{ + if (tetri == 0 + && (pos + 1) % square->size != 0 + && pos + square->size + 1 < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 1] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 1 + square->size] == '.') + return (SUCCESS); + if (tetri == 1 + && pos + 3 * square->size < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 3 * square->size] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 * square->size] == '.') + return (SUCCESS); + if (tetri == 2 + && (pos + 1) % square->size != 0 && (pos + 2) % square->size != 0 + && pos + 2 + square->size < square->size * square->size + && square->str[pos + 1] == '.' + && square->str[pos + 1 + square->size] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 + square->size] == '.') + return (SUCCESS); + return (check_square5(square, tetri, pos)); +} + +int check_square5(t_type *square, char tetri, int pos) +{ + if (tetri == 3 + && (pos + 1) % square->size != 0 && (pos + 2) % square->size != 0 + && pos + 1 + square->size < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 1] == '.' + && square->str[pos + square->size + 1] == '.' + && square->str[pos + 2] == '.') + return (SUCCESS); + if (tetri == 4 + && (pos + 1) % square->size != 0 + && pos + 2 * square->size < square->size * square->size + && square->str[pos + 1] == '.' + && square->str[pos + 1 + square->size] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 * square->size] == '.') + return (SUCCESS); + if (tetri == 5 + && (pos + 1) % square->size != 0 + && pos + 2 * square->size + 1 < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 1 + square->size] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 * square->size + 1] == '.') + return (SUCCESS); + return (check_square6(square, tetri, pos)); +} diff --git a/fillit_roduquen/check_square2.c b/fillit_roduquen/check_square2.c new file mode 100755 index 0000000..7f69585 --- /dev/null +++ b/fillit_roduquen/check_square2.c @@ -0,0 +1,55 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* check_square2.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:15 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:26:45 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" + +int check_square6(t_type *square, char tetri, int pos) +{ + if (tetri == 6 + && (pos + 1) % square->size != 0 && (pos + 2) % square->size != 0 + && pos + square->size < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 1] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2] == '.') + return (SUCCESS); + if (tetri == 7 + && (pos + 1) % square->size != 0 && (pos + 2) % square->size != 0 + && pos + 2 + square->size < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 1] == '.' + && square->str[pos + 2] == '.' + && square->str[pos + 2 + square->size] == '.') + return (SUCCESS); + if (tetri == 8 + && (pos + 1) % square->size != 0 && (pos + 2) % square->size != 0 + && pos + 2 + square->size < square->size * square->size + && square->str[pos] == '.' + && square->str[pos + 1 + square->size] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 + square->size] == '.') + return (SUCCESS); + return (check_square7(square, tetri, pos)); +} + +int check_square7(t_type *square, char tetri, int pos) +{ + if (tetri == 9 + && (pos + 1) % square->size != 0 && (pos + 2) % square->size != 0 + && pos + 2 + square->size < square->size * square->size + && square->str[pos + 2] == '.' + && square->str[pos + 1 + square->size] == '.' + && square->str[pos + square->size] == '.' + && square->str[pos + 2 + square->size] == '.') + return (SUCCESS); + return (ERROR); +} diff --git a/fillit_roduquen/count_island.c b/fillit_roduquen/count_island.c new file mode 100755 index 0000000..3117239 --- /dev/null +++ b/fillit_roduquen/count_island.c @@ -0,0 +1,126 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* count_island.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:17 by roduquen #+# #+# */ +/* Updated: 2019/04/01 19:13:25 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" +#include +#include + +int count_island(t_type *square, int i, char tetri[], int to_test) +{ + char nbr; + + ft_memset(square->isl, '.', 170); + nbr = 'a'; + while (1) + { + i = 0; + while (square->str[i]) + { + if (square->isl[i] == '.' && square->str[i] == '.') + break ; + i++; + } + if (square->str[i]) + square->isl[i] = nbr; + else + return (count_hole(square, nbr, tetri, to_test)); + full_count_island_square(square, nbr); + nbr++; + } + return (ERROR); +} + +void full_count_island_square(t_type *square, char nbr) +{ + int i; + int j; + + i = 0; + while (i < square->size * 2) + { + j = 0; + while (square->str[j]) + { + if (square->str[j] == '.' && square->isl[j] == '.') + ft_check_square(j, square, nbr); + j++; + } + i++; + } +} + +int count_hole(t_type *square, char nbr, char tetri[], int to_test) +{ + int i; + int nbr_hole; + int total; + + total = 0; + while (nbr >= 'a') + { + i = 0; + nbr_hole = 0; + while (i < square->size * square->size) + { + if (square->isl[i] == nbr) + nbr_hole++; + i++; + } + if (nbr_hole == 4) + total += check_new_possibility(square, nbr, tetri, to_test); + else + total += nbr_hole % 4; + nbr--; + } + return (total); +} + +int check_if_placing_tetri_is_possible(t_type *square, char tetri[], + int to_test, int i) +{ + while (tetri[to_test] != 42) + { + if (tetri[to_test] == -9 || tetri[to_test] == -7 + || tetri[to_test] == -6 || tetri[to_test] == -4 + || tetri[to_test] == -3 || tetri[to_test] == -1 + || tetri[to_test] == 0 || tetri[to_test] == 1 + || tetri[to_test] == 3 || tetri[to_test] == 5 + || tetri[to_test] == 6 || tetri[to_test] == 7 + || tetri[to_test] == 8) + { + if (check_square(square, tetri[to_test], i) == SUCCESS) + return (0); + } + else if (tetri[to_test] == -8 || tetri[to_test] == -5 + || tetri[to_test] == -2 || tetri[to_test] == 2 + || tetri[to_test] == 4) + { + if (check_square(square, tetri[to_test], i - 1) == SUCCESS) + return (0); + } + else if (check_square(square, tetri[to_test], i - 2) == SUCCESS) + return (0); + to_test++; + } + return (4); +} + +int check_new_possibility(t_type *square, char nbr, char tetri[], + int to_test) +{ + int i; + + i = 0; + while (square->isl[i] != nbr) + i++; + return (check_if_placing_tetri_is_possible(square, tetri, to_test, i)); +} diff --git a/fillit_roduquen/do_i_fillit.c b/fillit_roduquen/do_i_fillit.c new file mode 100755 index 0000000..6506693 --- /dev/null +++ b/fillit_roduquen/do_i_fillit.c @@ -0,0 +1,103 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* do_i_fillit.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:19 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:27:29 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include "fillit.h" +#include + +int do_i_fillit(char tetri[], int nbr) +{ + int i; + t_type *square; + + i = 0; + if (!(square = (t_type*)malloc(sizeof(t_type)))) + return (ERROR); + while (i * i < nbr * 4) + i++; + if (!(square->str = (char*)malloc(sizeof(char) * (i * i + 1)))) + return (free_error(square)); + square->size = i; + full_square_hole(square, nbr); + i = 0; + while (i < square->size * square->size) + square->str[i++] = '.'; + square->str[i] = 0; + return (do_i_fillit2(tetri, square)); +} + +int do_i_fillit2(char tetri[], t_type *square) +{ + int i; + + while (fillit(tetri, square) == ERROR) + { + free(square->str); + square->size++; + square->hole += square->size * 2 - 1; + if (!(square->str = (char*)malloc(sizeof(char) * (square->size + * square->size + 1)))) + return (free_error(square)); + i = 0; + while (i < square->size * square->size) + square->str[i++] = '.'; + square->str[i] = 0; + } + free(square->str); + free(square); + return (SUCCESS); +} + +int free_error(void *ptr) +{ + free(ptr); + return (ERROR); +} + +void print_tab(t_type *square) +{ + int i; + + i = 0; + while (i < square->size * square->size) + { + if (i != 0 && i % square->size == 0) + write(1, "\n", 1); + write(1, &square->str[i], 1); + i++; + } + write(1, "\n", 1); +} + +void full_square_hole(t_type *square, int nbr) +{ + if (nbr == 1 || nbr == 4 || nbr == 9 || nbr == 16 || nbr == 25) + square->hole = 0; + else if (nbr == 2 || nbr == 6 || nbr == 12 || nbr == 20) + square->hole = 1; + else if (nbr == 3 || nbr == 8 || nbr == 15 || nbr == 24) + square->hole = 4; + else if (nbr == 5 || nbr == 11 || nbr == 19) + square->hole = 5; + else if (nbr == 7 || nbr == 14 || nbr == 23) + square->hole = 8; + else if (nbr == 10 || nbr == 18) + square->hole = 9; + else if (nbr == 13 || nbr == 22) + square->hole = 12; + else if (nbr == 17) + square->hole = 13; + else if (nbr == 21) + square->hole = 16; + else + square->hole = 17; +} diff --git a/fillit_roduquen/external_file.txt b/fillit_roduquen/external_file.txt new file mode 100755 index 0000000..35ec368 --- /dev/null +++ b/fillit_roduquen/external_file.txt @@ -0,0 +1,564 @@ +#### +.... +.... +.... + +.... +#### +.... +.... + +.... +.... +#### +.... + +.... +.... +.... +#### + +#... +#... +#... +#... + +.#.. +.#.. +.#.. +.#.. + +..#. +..#. +..#. +..#. + +...# +...# +...# +...# + +.#.. +.#.. +##.. +.... + +..#. +..#. +.##. +.... + +...# +...# +..## +.... + +.... +.#.. +.#.. +##.. + +.... +..#. +..#. +.##. + +.... +...# +...# +..## + +###. +..#. +.... +.... + +.### +...# +.... +.... + +.... +###. +..#. +.... + +.... +.### +...# +.... + +.... +.... +###. +..#. + +.... +.... +.### +...# + +##.. +#... +#... +.... + +.##. +.#.. +.#.. +.... + +..## +..#. +..#. +.... + +.... +##.. +#... +#... + +.... +.##. +.#.. +.#.. + +.... +..## +..#. +..#. + +#... +###. +.... +.... + +.#.. +.### +.... +.... + +.... +#... +###. +.... + +.... +.#.. +.### +.... + +.... +.... +#... +###. + +.... +.... +.#.. +.### + +#... +#... +##.. +.... + +.#.. +.#.. +.##. +.... + +..#. +..#. +..## +.... + +.... +#... +#... +##.. + +.... +.#.. +.#.. +.##. + +.... +..#. +..#. +..## + +###. +#... +.... +.... + +.### +.#.. +.... +.... + +.... +###. +#... +.... + +.... +.### +.#.. +.... + +.... +.... +###. +#... + +.... +.... +.### +.#.. + +##.. +.#.. +.#.. +.... + +.##. +..#. +..#. +.... + +..## +...# +...# +.... + +.... +##.. +.#.. +.#.. + +.... +.##. +..#. +..#. + +.... +..## +...# +...# + +..#. +###. +.... +.... + +...# +.### +.... +.... + +.... +..#. +###. +.... + +.... +...# +.### +.... + +.... +.... +..#. +###. + +.... +.... +...# +.### + +##.. +##.. +.... +.... + +.##. +.##. +.... +.... + +..## +..## +.... +.... + +.... +##.. +##.. +.... + +.... +.##. +.##. +.... + +.... +..## +..## +.... + +.... +.... +##.. +##.. + +.... +.... +.##. +.##. + +.... +.... +..## +..## + +.##. +##.. +.... +.... + +..## +.##. +.... +.... + +.... +.##. +##.. +.... + +.... +..## +.##. +.... + +.... +.... +.##. +##.. + +.... +.... +..## +.##. + +#... +##.. +.#.. +.... + +.#.. +.##. +..#. +.... + +..#. +..## +...# +.... + +.... +#... +##.. +.#.. + +.... +.#.. +.##. +..#. + +.... +..#. +..## +...# + +###. +.#.. +.... +.... + +.### +..#. +.... +.... + +.... +###. +.#.. +.... + +.... +.### +..#. +.... + +.... +.... +###. +.#.. + +.... +.... +.### +..#. + +#... +##.. +#... +.... + +.#.. +.##. +.#.. +.... + +..#. +..## +..#. +.... + +.... +#... +##.. +#... + +.... +.#.. +.##. +.#.. + +.... +..#. +..## +..#. + +.#.. +###. +.... +.... + +..#. +.### +.... +.... + +.... +.#.. +###. +.... + +.... +..#. +.### +.... + +.... +.... +.#.. +###. + +.... +.... +..#. +.### + +.#.. +##.. +.#.. +.... + +..#. +.##. +..#. +.... + +...# +..## +...# +.... + +.... +.#.. +##.. +.#.. + +.... +..#. +.##. +..#. + +.... +...# +..## +...# + +##.. +.##. +.... +.... + +.##. +..## +.... +.... + +.... +##.. +.##. +.... + +.... +.##. +..## +.... + +.... +.... +##.. +.##. + +.... +.... +.##. +..## + +.#.. +##.. +#... +.... + +..#. +.##. +.#.. +.... + +...# +..## +..#. +.... + +.... +.#.. +##.. +#... + +.... +..#. +.##. +.#.. + +.... +...# +..## +..#. diff --git a/fillit_roduquen/fillit.c b/fillit_roduquen/fillit.c new file mode 100755 index 0000000..ebc91ba --- /dev/null +++ b/fillit_roduquen/fillit.c @@ -0,0 +1,127 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* fillit.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:23 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:28:16 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" + +int full_tetri(char tetri[], char buffer[], char bufftest[], int fd) +{ + int i; + + if (fd == 26) + return (FILE_ERROR); + i = ft_strstr(buffer, bufftest); + if (i == 0 || i == 21 || i == 42 || i == 63) + tetri[fd] = -1; + if (i == 84 || i == 105 || i == 126 || i == 147) + tetri[fd] = 1; + if (i == 168 || i == 189 || i == 210 || i == 231 || i == 252 || i == 273) + tetri[fd] = -8; + if (i == 294 || i == 315 || i == 336 || i == 357 || i == 378 || i == 399) + tetri[fd] = 7; + if (i == 420 || i == 441 || i == 462 || i == 483 || i == 504 || i == 525) + tetri[fd] = -7; + if (i == 546 || i == 567 || i == 588 || i == 609 || i == 630 || i == 651) + tetri[fd] = 8; + if (i == 672 || i == 693 || i == 714 || i == 735 || i == 756 || i == 777) + tetri[fd] = -6; + if (i == 798 || i == 819 || i == 840 || i == 861 || i == 882 || i == 903) + tetri[fd] = 6; + if (i == 924 || i == 945 || i == 966 || i == 987 || i == 1008 || i == 1029) + tetri[fd] = -9; + return (full_tetri2(i, tetri, fd)); +} + +int full_tetri2(int i, char tetri[], int fd) +{ + if (i == 1050 || i == 1071 || i == 1092 || i == 1113 || i == 1134 + || i == 1155) + tetri[fd] = 9; + if (i == 1176 || i == 1197 || i == 1218 || i == 1239 || i == 1260 + || i == 1281 || i == 1302 || i == 1323 || i == 1344) + tetri[fd] = 0; + if (i == 1365 || i == 1386 || i == 1407 || i == 1428 || i == 1449 + || i == 1470) + tetri[fd] = -5; + if (i == 1491 || i == 1512 || i == 1533 || i == 1554 || i == 1575 + || i == 1596) + tetri[fd] = 5; + if (i == 1617 || i == 1638 || i == 1659 || i == 1680 || i == 1701 + || i == 1722) + tetri[fd] = 3; + if (i == 1743 || i == 1764 || i == 1785 || i == 1806 || i == 1827 + || i == 1848) + tetri[fd] = -3; + if (i == 1869 || i == 1890 || i == 1911 || i == 1932 || i == 1953 + || i == 1974) + tetri[fd] = 2; + if (i == 1995 || i == 2016 || i == 2037 || i == 2058 || i == 2079 + || i == 2100) + tetri[fd] = -2; + return (full_tetri3(i, tetri, fd)); +} + +int full_tetri3(int i, char tetri[], int fd) +{ + if (i == 2121 || i == 2142 || i == 2163 || i == 2184 || i == 2205 + || i == 2226) + tetri[fd] = -4; + if (i == 2247 || i == 2268 || i == 2289 || i == 2310 || i == 2331 + || i == 2352) + tetri[fd] = 4; + if (tetri[fd] == 42) + return (FILE_ERROR); + return (SUCCESS); +} + +int fillit(char tetri[], t_type *square) +{ + int i; + int j; + + i = 0; + j = 0; + while (j >= 0) + { + if (check_square(square, tetri[j], i) == SUCCESS) + { + if (fillit2(square, tetri, &j, &i) == SUCCESS) + return (SUCCESS); + } + else if (square->str[i]) + i++; + else + { + j--; + if (j >= 0) + i = remove_square(square, j + 'A', tetri[j]); + } + } + return (ERROR); +} + +int fillit2(t_type *square, char tetri[], int *j, int *i) +{ + full_square(square, tetri[*j], *j + 'A', *i); + if (tetri[*j + 1] != 42 && check_hole(square, tetri, *j + 1) != SUCCESS) + *i = remove_square(square, *j + 'A', tetri[*j]); + else + { + *i = i_fillit_the_power(square, tetri, *j + 1); + *j += 1; + } + if (tetri[*j] == 42) + { + print_tab(square); + return (SUCCESS); + } + return (CONTINUE); +} diff --git a/fillit_roduquen/fillit.h b/fillit_roduquen/fillit.h new file mode 100755 index 0000000..8d892c9 --- /dev/null +++ b/fillit_roduquen/fillit.h @@ -0,0 +1,91 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* fillit.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:28:32 by roduquen #+# #+# */ +/* Updated: 2019/04/01 19:01:09 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef FILLIT_H +# define FILLIT_H + +/* +** MACROS +*/ + +# define SUCCESS 0 +# define ERROR -1 +# define READ_ERROR -2 +# define OPEN_ERROR -3 +# define FILE_ERROR -4 +# define CONTINUE 1 +# define BUFF_SIZE 2372 + +/* +** TYPEDEF && STRUCTURES +*/ + +typedef struct s_type +{ + int size; + int hole; + char *str; + char isl[170]; +} t_type; + +/* +** PROTOTYPES +*/ + +int fillit(char tetri[], t_type *square); +int fillit2(t_type *square, char tetri[], int *j, int *i); +void full_square(t_type *square, char tetri, char nbr, int pos); +void full_square2(t_type *square, char tetri, char nbr, int pos); +void full_square3(t_type *square, char tetri, char nbr, int pos); +void full_square4(t_type *square, char tetri, char nbr, int pos); +void full_square5(t_type *square, char tetri, char nbr, int pos); +void full_square6(t_type *square, char tetri, char nbr, int pos); +int check_square(t_type *square, char tetri, int pos); +int check_square2(t_type *square, char tetri, int pos); +int check_square3(t_type *square, char tetri, int pos); +int check_square4(t_type *square, char tetri, int pos); +int check_square5(t_type *square, char tetri, int pos); +int check_square6(t_type *square, char tetri, int pos); +int check_square7(t_type *square, char tetri, int pos); +int remove_square(t_type *square, char nbr, char type); +int i_fillit_the_power(t_type *square, char tetri[], int pos); +int i_got_a_fillit(int check_fd); +int check_file(char bufftest[], char tetri[], char buffer[], + int fd); +int free_error(void *ptr); +int do_i_fillit(char tetri[], int nbr); +int do_i_fillit2(char tetri[], t_type *square); +void print_tab(t_type *square); +int full_tetri(char tetri[], char buffer[], char bufftest[], + int fd); +int full_tetri2(int i, char tetri[], int fd); +int full_tetri3(int i, char tetri[], int fd); +int ft_strstr(char haystack[], char needle[]); +int chose_type(char type, int ret); +int check_hole(t_type *square, char tetri[], int to_test); +void full_square_hole(t_type *square, int nbr); +int ft_check_square(int i, t_type *square, char nbr); +int ft_check_square2(int i, t_type *square, char nbr); +int ft_check_square3(int i, t_type *square, char nbr); +int ft_check_square4(int i, t_type *square, char nbr); +int ft_check_square5(int i, t_type *square, char nbr); +int ft_check_square6(int i, t_type *square, char nbr); +int count_island(t_type *square, int i, char tetri[], + int to_test); +void full_count_island_square(t_type *square, char nbr); +int count_hole(t_type *square, char nbr, char tetri[], + int to_test); +void ft_memset(void *ptr, char c, int len); +int check_new_possibility(t_type *square, char nbr, + char tetri[], int to_test); + +#endif diff --git a/fillit_roduquen/full_square.c b/fillit_roduquen/full_square.c new file mode 100755 index 0000000..166b873 --- /dev/null +++ b/fillit_roduquen/full_square.c @@ -0,0 +1,148 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* full_square.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:25 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:29:03 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" + +void full_square(t_type *square, char tetri, char nbr, int pos) +{ + if (tetri == -9) + { + square->str[pos] = nbr; + square->str[pos + 1] = nbr; + square->str[pos + square->size + 1] = nbr; + square->str[pos + 2 * square->size + 1] = nbr; + } + else if (tetri == -8) + { + square->str[pos + 1] = nbr; + square->str[pos + 1 + square->size] = nbr; + square->str[pos + 2 * square->size] = nbr; + square->str[pos + 2 * square->size + 1] = nbr; + } + else if (tetri == -7) + { + square->str[pos] = nbr; + square->str[pos + 1] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + 2 * square->size] = nbr; + } + else + full_square2(square, tetri, nbr, pos); +} + +void full_square2(t_type *square, char tetri, char nbr, int pos) +{ + if (tetri == -6) + { + square->str[pos] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + 2 * square->size] = nbr; + square->str[pos + 2 * square->size + 1] = nbr; + } + else if (tetri == -5) + { + square->str[pos + 1] = nbr; + square->str[pos + 2] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + square->size + 1] = nbr; + } + else if (tetri == -4) + { + square->str[pos] = nbr; + square->str[pos + 1] = nbr; + square->str[pos + square->size + 1] = nbr; + square->str[pos + square->size + 2] = nbr; + } + else + full_square3(square, tetri, nbr, pos); +} + +void full_square3(t_type *square, char tetri, char nbr, int pos) +{ + if (tetri == -3) + { + square->str[pos] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + square->size + 1] = nbr; + square->str[pos + 2 * square->size] = nbr; + } + else if (tetri == -2) + { + square->str[pos + 1] = nbr; + square->str[pos + 1 + square->size] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + 2 * square->size + 1] = nbr; + } + else if (tetri == -1) + { + square->str[pos] = nbr; + square->str[pos + 1] = nbr; + square->str[pos + 2] = nbr; + square->str[pos + 3] = nbr; + } + else + full_square4(square, tetri, nbr, pos); +} + +void full_square4(t_type *square, char tetri, char nbr, int pos) +{ + if (tetri == 0) + { + square->str[pos] = nbr; + square->str[pos + 1] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + square->size + 1] = nbr; + } + else if (tetri == 1) + { + square->str[pos] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + square->size * 2] = nbr; + square->str[pos + 3 * square->size] = nbr; + } + else if (tetri == 2) + { + square->str[pos + 1] = nbr; + square->str[pos + 1 + square->size] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + square->size + 2] = nbr; + } + else + full_square5(square, tetri, nbr, pos); +} + +void full_square5(t_type *square, char tetri, char nbr, int pos) +{ + if (tetri == 3) + { + square->str[pos] = nbr; + square->str[pos + 1] = nbr; + square->str[pos + 2] = nbr; + square->str[pos + square->size + 1] = nbr; + } + else if (tetri == 4) + { + square->str[pos + 1] = nbr; + square->str[pos + 1 + square->size] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + 2 * square->size] = nbr; + } + else if (tetri == 5) + { + square->str[pos] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + square->size + 1] = nbr; + square->str[pos + 2 * square->size + 1] = nbr; + } + else + full_square6(square, tetri, nbr, pos); +} diff --git a/fillit_roduquen/full_square2.c b/fillit_roduquen/full_square2.c new file mode 100755 index 0000000..1214925 --- /dev/null +++ b/fillit_roduquen/full_square2.c @@ -0,0 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* full_square2.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:29 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:12:30 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" + +void full_square6(t_type *square, char tetri, char nbr, int pos) +{ + if (tetri == 6) + { + square->str[pos + 1] = nbr; + square->str[pos + 2] = nbr; + square->str[pos] = nbr; + square->str[pos + square->size] = nbr; + } + else if (tetri == 7) + { + square->str[pos] = nbr; + square->str[pos + 1] = nbr; + square->str[pos + 2] = nbr; + square->str[pos + square->size + 2] = nbr; + } + else if (tetri == 8 || tetri == 9) + { + square->str[(tetri == 8 ? pos : pos + 2)] = nbr; + square->str[pos + square->size] = nbr; + square->str[pos + 1 + square->size] = nbr; + square->str[pos + square->size + 2] = nbr; + } +} diff --git a/fillit_roduquen/init.c b/fillit_roduquen/init.c new file mode 100755 index 0000000..6a6bade --- /dev/null +++ b/fillit_roduquen/init.c @@ -0,0 +1,53 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* init.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:31 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:12:32 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" +#include +#include + +int i_got_a_fillit(int check_fd) +{ + int fd; + char buffer[BUFF_SIZE]; + char bufftest[21]; + char tetri[27]; + int ret; + + ft_memset(bufftest, 42, 21); + ft_memset(tetri, 42, 27); + bufftest[20] = 0; + if ((fd = open("external_file.txt", O_RDONLY)) < 0) + return (OPEN_ERROR); + if (read(fd, buffer, BUFF_SIZE) <= 0) + return (READ_ERROR); + fd = 0; + while ((ret = read(check_fd, bufftest, 20)) > 0) + { + if (ret != 20 || check_file(bufftest, tetri, buffer, fd) != SUCCESS) + return (FILE_ERROR); + if (read(check_fd, bufftest, 1) > 0 && bufftest[0] != '\n') + return (FILE_ERROR); + tetri[++fd] = 42; + } + if (ret < 0 || fd == 0 || bufftest[0] == '\n') + return (FILE_ERROR); + return (do_i_fillit(tetri, fd)); +} + +int check_file(char bufftest[], char tetri[], char buffer[], int fd) +{ + if (bufftest[0] != '.' && bufftest[0] != '#') + return (FILE_ERROR); + if (full_tetri(tetri, buffer, bufftest, fd) != SUCCESS) + return (FILE_ERROR); + return (SUCCESS); +} diff --git a/fillit_roduquen/main.c b/fillit_roduquen/main.c new file mode 100755 index 0000000..5ef635c --- /dev/null +++ b/fillit_roduquen/main.c @@ -0,0 +1,42 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:34 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:12:35 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" +#include +#include + +int main(int ac, char **av) +{ + int fd; + + if (ac != 2 || (fd = open(av[1], O_DIRECTORY | O_RDONLY)) >= 0) + { + write(2, "fillit: usage : fillit [PATH/FILE]\n", 35); + return (-1); + } + if ((fd = open(av[1], O_RDONLY)) == -1) + { + write(2, "fillit: usage : fillit [PATH/FILE]\n", 35); + return (-1); + } + else + { + if ((fd = i_got_a_fillit(fd)) < 0) + { + if (fd == FILE_ERROR || fd == ERROR) + write(1, "error\n", 6); + if (fd == OPEN_ERROR || fd == READ_ERROR) + write(2, "Something went wrong, please try again\n", 39); + } + } + return (fd); +} diff --git a/fillit_roduquen/remove_square.c b/fillit_roduquen/remove_square.c new file mode 100755 index 0000000..96345a2 --- /dev/null +++ b/fillit_roduquen/remove_square.c @@ -0,0 +1,46 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* remove_square.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:36 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:12:38 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" + +int remove_square(t_type *square, char nbr, char type) +{ + int i; + int ret; + + i = 0; + ret = -1; + while (square->str[i]) + { + if (square->str[i] == nbr) + { + if (ret == -1) + ret = i; + square->str[i] = '.'; + } + i++; + } + return (chose_type(type, ret)); +} + +int chose_type(char type, int ret) +{ + if (type == -9 || type == -7 || type == -6 || type == -4 + || type == -3 || type == -1 || type == 0 || type == 1 + || type == 3 || type == 5 || type == 6 || type == 7 + || type == 8) + return (ret + 1); + else if (type == 9) + return (ret - 1); + else + return (ret); +} diff --git a/fillit_roduquen/utilitys.c b/fillit_roduquen/utilitys.c new file mode 100755 index 0000000..f823a5a --- /dev/null +++ b/fillit_roduquen/utilitys.c @@ -0,0 +1,42 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* utilitys.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: roduquen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/04/01 17:12:39 by roduquen #+# #+# */ +/* Updated: 2019/04/01 17:12:50 by roduquen ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "fillit.h" + +int ft_strstr(char haystack[], char needle[]) +{ + int i; + int j; + + i = 0; + while (i < BUFF_SIZE) + { + j = 0; + while (i + j < BUFF_SIZE && needle[j] && needle[j] == haystack[i + j]) + j++; + if (!needle[j]) + return (i); + i++; + } + return (ERROR); +} + +void ft_memset(void *ptr, char c, int len) +{ + int i; + unsigned char *str; + + i = 0; + str = (unsigned char*)ptr; + while (i < len) + str[i++] = c; +} diff --git a/libft/Makefile b/libft/Makefile index 2a5736b..c57154e 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -1,223 +1,46 @@ -## -# # ------------------------------------------------------ -# # utiliser le makefile pour creer une librairie statique -# # ------------------------------------------------------ -## -## -## - - - - - - - - -## compiler des .o -## - - - - - - - - -## -## -## quand on ecrit un programme il contient un main et les -## fonctions dont le main a besoin (ex ft_putchar) : -## -### #include -### -### void ft_putchar(char c) -### { -### write(1, &c, 1); -### } -### -### int main() -### { -### ft_putchar('0'); -### return (0); -### } -## -## on peut compiler ce fichier avec gcc en faisant : -## gcc file.c -## et ca sort un executable a.out -## si on l'execute "./a.out" ca ecrit 0 dans la console -## -## mais pour ne pas reecrire a chaque fois ft_putchar -## on peut la mettre dans une librairie qu'on inclue dans -## le fichier qui l'utilise... -## si on sort ft_putchar du fichier : -## -### int main() -### { -### ft_putchar('0'); -### return (0); -### } -## -## et qu'on l'execute "gcc file.c" on va avoir une erreur -## car file.c utilise ft_putchar mais gcc ne sait pas ce -## que c'est, donc il faut qu'on le rajoute a la compilation -## on peut par exemple l'ecrire dans un fichier ft_putchar.c -## -### #include -### -### void ft_putchar(char c) -### { -### write(1, &c, 1); -### } -## -## et compiler les deux : -## gcc file.c ft_putchar.c -## -## ca fonctionne mais gcc doit a chaque fois recompiler -## ft_putchar.c alors qu'il n'est pas modifie, donc on peut -## le compiler une bonne fois pour toute et le rajouter a la -## compilation finale quand on en a besoin sans que l'ordi -## ait a tout retraduire dans son langage -## -## mais si on essaye de compiler ft_putchar seul -## gcc ft_putchar.c -## ca nous donne une erreur car pour compiler, gcc a besoin -## de trouver un main ! -## -## on va donc utiliser l'option -c pour -## creer une fichier objet .o qui est deja traduit en langue -## d'ordinateur et pret a etre rajoute a la compilation : -## gcc -c ft_putchar.c --> donne ft_putchar.o -## qu'on peut compiler avec le fichier qui contient le main : -## -## gcc file.c ft_putchar.o -## -## on a nos bouts de codes comme ft_putchar.o dans des fichiers -## objets prets a etre ajoutes a la compilation du main -## -## on va maintenant voir comment faire une libraire qui contien -## tous nos fichiers objets -## -## -## - - - - - - - - -## creer une lib.a -## - - - - - - - - -## -## -## pour mettre tous les fichiers .o dans un seul fichier .a -## on utilise un programme d'archive ar avec les options rc -## r indique d'inserer les .o en remplacant si necessaire -## c de creer une nouvelle archive -## le nom de l'archive doit commencer par lib et finir en .a : -## ar rc nom_de_l'archive fichier_1.o fichier_2.o etc -## -## ar rc libtest.a ft_putchar.o -## -## on obtient un fichier libtest.a qui contient les fichiers -## objets .o -## -## on peut l'utiliser a la compilation de cette manniere : -## -## gcc file.c -L. -ltest -## -## -L indique ou est la librairie (ici elle est dans le -## dossier courant .) -## -l indique son nom ("test" car on n'indique pas lib et .a) -## -## -# # ----------------------------------------------- -# # ecrire un make file pour aider a la compilation -# # ----------------------------------------------- -## -## -## exemple d'un makefilede basic -## -### NAME = libtest.h -### CC = gcc -### CFLAGS = -I. -c -### SRCS = example01.c \ -### example02.c -### OBJ = $(SRCS:.c=.o) |ecrit les fichiers .c en .o -### -### all: $(NAME) |make execute sa premiere regle NAME -### $(NAME): $(OBJ) |NAME execute d'abord OBJ -### ar -rc $@ $< | -## -## Make a des built-in pattern rules : -## https://www.gnu.org/software/make/manual/html_node/Catalogue-of-Rules.html -## par exemple pour construire des .o a partir de .c -## qui sont utilisees par défaut si les variables -## sont bien nomee (genre CC ou CFLAGS) -## -## cependant si on veut mettre les fichiers .o dans un -## sous-fichier BUILDS il n'y a pas de built-in pattern -## il faut donc l'ecrire nous-meme : -## -### NAME = libtest.h -### CC = gcc -### CFLAGS = -I. -### SRCS = example01.c \ -### example02.c -### ODIR = ./builds -### OBJS = $(addprefix $(ODIR)/, $(SRCS:.c=.o)) -### -### all: $(NAME) -### $(NAME): $(OBJS) -### ar -rc $@ $< -### -### $(ODIR)/%.o : %.c -### $(COMPILE.c) -o $@ $< -## -## cette regle est appellee par $(OBJS) puisque -## cette variable appelle la regle $(ODIR/file.o) -## -## COMPILE est une built-in variable qui execute -## les regles CC et CFLAGS avec l'option -c -## -## % = "tout" -## $@ = "la valeur a gauche de :" -## $< = "la premiere valeur a droite de :" -## $^ = "toutes les valeurs a droite de :" -## -## - - -# ----------------------------------------------------------- # -# # -# variables modifiables # -# # -# ----------------------------------------------------------- # +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: hulamy +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2019/06/03 21:52:28 by hulamy #+# #+# # +# Updated: 2019/06/03 21:52:33 by hulamy ### ########.fr # +# # +# **************************************************************************** # NAME = libft.a -DEPS = libft.h +CFLAGS = -Wall -Wextra -Werror -I. -SDIR = ./src -ODIR = ./build -IDIR = ./includes - -CC = gcc -CFLAGS = -Wall -Wextra -Werror -I$(IDIR) +SRCS = ft_isdigit.c ft_memccpy.c ft_putnbr.c ft_strcpy.c ft_strmapi.c ft_strsub.c \ + ft_any.c ft_isprint.c ft_memchr.c ft_putnbr_fd.c ft_strdel.c ft_strmultisplit.c ft_strtrim.c \ + ft_arraymap.c ft_issort.c ft_memcmp.c ft_putnbrbase.c ft_strdup.c ft_strncat.c ft_tolower.c \ + ft_atoi.c ft_itoa.c ft_memcpy.c ft_putnbrendl.c ft_strequ.c ft_strncmp.c ft_toupper.c \ + ft_atoibase.c ft_lstadd.c ft_memdel.c ft_putnbrendl_fd.c ft_striter.c ft_strncpy.c \ + ft_bzero.c ft_lstdel.c ft_memmove.c ft_putstr.c ft_striteri.c ft_strnequ.c \ + ft_convertbase.c ft_lstdelone.c ft_memset.c ft_putstr_fd.c ft_strjoin.c ft_strnew.c \ + ft_foreach.c ft_lstiter.c ft_putchar.c ft_strcat.c ft_strjoinfree.c ft_strnstr.c \ + ft_isalnum.c ft_lstmap.c ft_putchar_fd.c ft_strchr.c ft_strlcat.c ft_strrchr.c \ + ft_isalpha.c ft_lstnew.c ft_putendl.c ft_strclr.c ft_strlen.c ft_strsplit.c \ + ft_isascii.c ft_memalloc.c ft_putendl_fd.c ft_strcmp.c ft_strmap.c ft_strstr.c -# ----------------------------------------------------------- # -# # -# ne pas modifier en dessous # -# # -# ----------------------------------------------------------- # +OBJS = $(SRCS:.c=.o) -## SUB_SDIR sera utilise pour creer les sous dossiers : -## avec mkdir -p ODIR/subdir1 ODIR/subdir2 ODIR/subdir3 etc... -## find $(SDIR) cherche recursivement tous le contenu de SDIR -## -type d ne trouve que les dossiers, pas les fichiers -## -mindepth 1 ne liste pas le dossier SDIR -## subst transform arg1 en arg2 dans arg3 +all: $(NAME) -SUB_SDIR = $(shell find $(SDIR) -mindepth 1 -type d) -SRC = $(shell find $(SDIR) -type f -not -name '.*' -name '*.c') -OBJ = $(subst $(SDIR), $(ODIR), $(SRC:.c=.o)) - -all: $(ODIR) $(NAME) - -$(ODIR): - mkdir -p $(subst $(SDIR), $(ODIR), $(SUB_SDIR)) - -$(ODIR)/%.o: $(SDIR)/%.c - $(COMPILE.c) -o $@ $< - -$(NAME): $(OBJ) - ar -rc $@ $^ - @ranlib $@ +$(NAME): $(SRCS) + @gcc $(CFLAGS) -c $(SRCS) + @ar -rc $(NAME) $(OBJS) + @ranlib $(NAME) clean: - /bin/rm -rf $(ODIR) + @/bin/rm -f $(OBJS) fclean: clean - /bin/rm -f $(NAME) + @/bin/rm -f $(NAME) re: fclean all -.PHONY: clean diff --git a/libft/src/tab/ft_any.c b/libft/ft_any.c similarity index 100% rename from libft/src/tab/ft_any.c rename to libft/ft_any.c diff --git a/libft/src/tab/ft_arraymap.c b/libft/ft_arraymap.c similarity index 100% rename from libft/src/tab/ft_arraymap.c rename to libft/ft_arraymap.c diff --git a/libft/src/trsf/ft_atoi.c b/libft/ft_atoi.c similarity index 100% rename from libft/src/trsf/ft_atoi.c rename to libft/ft_atoi.c diff --git a/libft/src/trsf/ft_atoibase.c b/libft/ft_atoibase.c similarity index 100% rename from libft/src/trsf/ft_atoibase.c rename to libft/ft_atoibase.c diff --git a/libft/src/trsf/ft_bzero.c b/libft/ft_bzero.c similarity index 100% rename from libft/src/trsf/ft_bzero.c rename to libft/ft_bzero.c diff --git a/libft/src/trsf/ft_convertbase.c b/libft/ft_convertbase.c similarity index 100% rename from libft/src/trsf/ft_convertbase.c rename to libft/ft_convertbase.c diff --git a/libft/src/tab/ft_foreach.c b/libft/ft_foreach.c similarity index 100% rename from libft/src/tab/ft_foreach.c rename to libft/ft_foreach.c diff --git a/libft/src/is/ft_isalnum.c b/libft/ft_isalnum.c similarity index 100% rename from libft/src/is/ft_isalnum.c rename to libft/ft_isalnum.c diff --git a/libft/src/is/ft_isalpha.c b/libft/ft_isalpha.c similarity index 100% rename from libft/src/is/ft_isalpha.c rename to libft/ft_isalpha.c diff --git a/libft/src/is/ft_isascii.c b/libft/ft_isascii.c similarity index 100% rename from libft/src/is/ft_isascii.c rename to libft/ft_isascii.c diff --git a/libft/src/is/ft_isdigit.c b/libft/ft_isdigit.c similarity index 100% rename from libft/src/is/ft_isdigit.c rename to libft/ft_isdigit.c diff --git a/libft/src/is/ft_isprint.c b/libft/ft_isprint.c similarity index 100% rename from libft/src/is/ft_isprint.c rename to libft/ft_isprint.c diff --git a/libft/src/is/ft_issort.c b/libft/ft_issort.c similarity index 100% rename from libft/src/is/ft_issort.c rename to libft/ft_issort.c diff --git a/libft/src/trsf/ft_itoa.c b/libft/ft_itoa.c similarity index 100% rename from libft/src/trsf/ft_itoa.c rename to libft/ft_itoa.c diff --git a/libft/src/lst/ft_lstadd.c b/libft/ft_lstadd.c similarity index 100% rename from libft/src/lst/ft_lstadd.c rename to libft/ft_lstadd.c diff --git a/libft/src/lst/ft_lstdel.c b/libft/ft_lstdel.c similarity index 100% rename from libft/src/lst/ft_lstdel.c rename to libft/ft_lstdel.c diff --git a/libft/src/lst/ft_lstdelone.c b/libft/ft_lstdelone.c similarity index 100% rename from libft/src/lst/ft_lstdelone.c rename to libft/ft_lstdelone.c diff --git a/libft/src/lst/ft_lstiter.c b/libft/ft_lstiter.c similarity index 100% rename from libft/src/lst/ft_lstiter.c rename to libft/ft_lstiter.c diff --git a/libft/src/lst/ft_lstmap.c b/libft/ft_lstmap.c similarity index 100% rename from libft/src/lst/ft_lstmap.c rename to libft/ft_lstmap.c diff --git a/libft/src/lst/ft_lstnew.c b/libft/ft_lstnew.c similarity index 100% rename from libft/src/lst/ft_lstnew.c rename to libft/ft_lstnew.c diff --git a/libft/src/mem/ft_memalloc.c b/libft/ft_memalloc.c similarity index 100% rename from libft/src/mem/ft_memalloc.c rename to libft/ft_memalloc.c diff --git a/libft/src/mem/ft_memccpy.c b/libft/ft_memccpy.c similarity index 100% rename from libft/src/mem/ft_memccpy.c rename to libft/ft_memccpy.c diff --git a/libft/src/mem/ft_memchr.c b/libft/ft_memchr.c similarity index 100% rename from libft/src/mem/ft_memchr.c rename to libft/ft_memchr.c diff --git a/libft/src/mem/ft_memcmp.c b/libft/ft_memcmp.c similarity index 100% rename from libft/src/mem/ft_memcmp.c rename to libft/ft_memcmp.c diff --git a/libft/src/mem/ft_memcpy.c b/libft/ft_memcpy.c similarity index 100% rename from libft/src/mem/ft_memcpy.c rename to libft/ft_memcpy.c diff --git a/libft/src/mem/ft_memdel.c b/libft/ft_memdel.c similarity index 100% rename from libft/src/mem/ft_memdel.c rename to libft/ft_memdel.c diff --git a/libft/src/mem/ft_memmove.c b/libft/ft_memmove.c similarity index 100% rename from libft/src/mem/ft_memmove.c rename to libft/ft_memmove.c diff --git a/libft/src/mem/ft_memset.c b/libft/ft_memset.c similarity index 100% rename from libft/src/mem/ft_memset.c rename to libft/ft_memset.c diff --git a/libft/src/put/ft_putchar.c b/libft/ft_putchar.c similarity index 100% rename from libft/src/put/ft_putchar.c rename to libft/ft_putchar.c diff --git a/libft/src/put/ft_putchar_fd.c b/libft/ft_putchar_fd.c similarity index 100% rename from libft/src/put/ft_putchar_fd.c rename to libft/ft_putchar_fd.c diff --git a/libft/src/put/ft_putendl.c b/libft/ft_putendl.c similarity index 100% rename from libft/src/put/ft_putendl.c rename to libft/ft_putendl.c diff --git a/libft/src/put/ft_putendl_fd.c b/libft/ft_putendl_fd.c similarity index 100% rename from libft/src/put/ft_putendl_fd.c rename to libft/ft_putendl_fd.c diff --git a/libft/src/put/ft_putnbr.c b/libft/ft_putnbr.c similarity index 100% rename from libft/src/put/ft_putnbr.c rename to libft/ft_putnbr.c diff --git a/libft/src/put/ft_putnbr_fd.c b/libft/ft_putnbr_fd.c similarity index 100% rename from libft/src/put/ft_putnbr_fd.c rename to libft/ft_putnbr_fd.c diff --git a/libft/src/put/ft_putnbrbase.c b/libft/ft_putnbrbase.c similarity index 100% rename from libft/src/put/ft_putnbrbase.c rename to libft/ft_putnbrbase.c diff --git a/libft/src/put/ft_putnbrendl.c b/libft/ft_putnbrendl.c similarity index 100% rename from libft/src/put/ft_putnbrendl.c rename to libft/ft_putnbrendl.c diff --git a/libft/src/put/ft_putnbrendl_fd.c b/libft/ft_putnbrendl_fd.c similarity index 100% rename from libft/src/put/ft_putnbrendl_fd.c rename to libft/ft_putnbrendl_fd.c diff --git a/libft/src/put/ft_putstr.c b/libft/ft_putstr.c similarity index 100% rename from libft/src/put/ft_putstr.c rename to libft/ft_putstr.c diff --git a/libft/src/put/ft_putstr_fd.c b/libft/ft_putstr_fd.c similarity index 100% rename from libft/src/put/ft_putstr_fd.c rename to libft/ft_putstr_fd.c diff --git a/libft/src/str/ft_strcat.c b/libft/ft_strcat.c similarity index 100% rename from libft/src/str/ft_strcat.c rename to libft/ft_strcat.c diff --git a/libft/src/str/ft_strchr.c b/libft/ft_strchr.c similarity index 100% rename from libft/src/str/ft_strchr.c rename to libft/ft_strchr.c diff --git a/libft/src/str/ft_strclr.c b/libft/ft_strclr.c similarity index 100% rename from libft/src/str/ft_strclr.c rename to libft/ft_strclr.c diff --git a/libft/src/str/ft_strcmp.c b/libft/ft_strcmp.c similarity index 100% rename from libft/src/str/ft_strcmp.c rename to libft/ft_strcmp.c diff --git a/libft/src/str/ft_strcpy.c b/libft/ft_strcpy.c similarity index 100% rename from libft/src/str/ft_strcpy.c rename to libft/ft_strcpy.c diff --git a/libft/src/str/ft_strdel.c b/libft/ft_strdel.c similarity index 100% rename from libft/src/str/ft_strdel.c rename to libft/ft_strdel.c diff --git a/libft/src/str/ft_strdup.c b/libft/ft_strdup.c similarity index 100% rename from libft/src/str/ft_strdup.c rename to libft/ft_strdup.c diff --git a/libft/src/str/ft_strequ.c b/libft/ft_strequ.c similarity index 100% rename from libft/src/str/ft_strequ.c rename to libft/ft_strequ.c diff --git a/libft/src/str/ft_striter.c b/libft/ft_striter.c similarity index 100% rename from libft/src/str/ft_striter.c rename to libft/ft_striter.c diff --git a/libft/src/str/ft_striteri.c b/libft/ft_striteri.c similarity index 100% rename from libft/src/str/ft_striteri.c rename to libft/ft_striteri.c diff --git a/libft/src/str/ft_strjoin.c b/libft/ft_strjoin.c similarity index 100% rename from libft/src/str/ft_strjoin.c rename to libft/ft_strjoin.c diff --git a/libft/src/str/ft_strjoinfree.c b/libft/ft_strjoinfree.c similarity index 100% rename from libft/src/str/ft_strjoinfree.c rename to libft/ft_strjoinfree.c diff --git a/libft/src/str/ft_strlcat.c b/libft/ft_strlcat.c similarity index 100% rename from libft/src/str/ft_strlcat.c rename to libft/ft_strlcat.c diff --git a/libft/src/str/ft_strlen.c b/libft/ft_strlen.c similarity index 100% rename from libft/src/str/ft_strlen.c rename to libft/ft_strlen.c diff --git a/libft/src/str/ft_strmap.c b/libft/ft_strmap.c similarity index 100% rename from libft/src/str/ft_strmap.c rename to libft/ft_strmap.c diff --git a/libft/src/str/ft_strmapi.c b/libft/ft_strmapi.c similarity index 100% rename from libft/src/str/ft_strmapi.c rename to libft/ft_strmapi.c diff --git a/libft/src/str/ft_strmultisplit.c b/libft/ft_strmultisplit.c similarity index 100% rename from libft/src/str/ft_strmultisplit.c rename to libft/ft_strmultisplit.c diff --git a/libft/src/str/ft_strncat.c b/libft/ft_strncat.c similarity index 100% rename from libft/src/str/ft_strncat.c rename to libft/ft_strncat.c diff --git a/libft/src/str/ft_strncmp.c b/libft/ft_strncmp.c similarity index 100% rename from libft/src/str/ft_strncmp.c rename to libft/ft_strncmp.c diff --git a/libft/src/str/ft_strncpy.c b/libft/ft_strncpy.c similarity index 100% rename from libft/src/str/ft_strncpy.c rename to libft/ft_strncpy.c diff --git a/libft/src/str/ft_strnequ.c b/libft/ft_strnequ.c similarity index 100% rename from libft/src/str/ft_strnequ.c rename to libft/ft_strnequ.c diff --git a/libft/src/str/ft_strnew.c b/libft/ft_strnew.c similarity index 100% rename from libft/src/str/ft_strnew.c rename to libft/ft_strnew.c diff --git a/libft/src/str/ft_strnstr.c b/libft/ft_strnstr.c similarity index 100% rename from libft/src/str/ft_strnstr.c rename to libft/ft_strnstr.c diff --git a/libft/src/str/ft_strrchr.c b/libft/ft_strrchr.c similarity index 100% rename from libft/src/str/ft_strrchr.c rename to libft/ft_strrchr.c diff --git a/libft/src/str/ft_strsplit.c b/libft/ft_strsplit.c similarity index 100% rename from libft/src/str/ft_strsplit.c rename to libft/ft_strsplit.c diff --git a/libft/src/str/ft_strstr.c b/libft/ft_strstr.c similarity index 100% rename from libft/src/str/ft_strstr.c rename to libft/ft_strstr.c diff --git a/libft/src/str/ft_strsub.c b/libft/ft_strsub.c similarity index 100% rename from libft/src/str/ft_strsub.c rename to libft/ft_strsub.c diff --git a/libft/src/str/ft_strtrim.c b/libft/ft_strtrim.c similarity index 100% rename from libft/src/str/ft_strtrim.c rename to libft/ft_strtrim.c diff --git a/libft/src/trsf/ft_tolower.c b/libft/ft_tolower.c similarity index 100% rename from libft/src/trsf/ft_tolower.c rename to libft/ft_tolower.c diff --git a/libft/src/trsf/ft_toupper.c b/libft/ft_toupper.c similarity index 100% rename from libft/src/trsf/ft_toupper.c rename to libft/ft_toupper.c diff --git a/libft/libft.a b/libft/libft.a index 4c900aae8e664f14f4a8a9fb4f286cf9225884ca..47df4915df195a80aacb443471ac810182d5dc3b 100644 GIT binary patch delta 2469 zcmZ{ke{54#6vw}7H#QWhlj5La7(bc~FtG6>Yo|f^As7M%f(Dp``P#nG&i1|X`noZK zsbVxE{$jp}Fieod2+oj9u2BpTCkB~_0Z|bM!7U*H8zY?(1N`NA@9o}O6L|l8@44rk z&-rniUK{dW8}jaWXhe8kxV~YowP1Z!S7>VPNzgYQ*h6yvT%bT&u>yF!gbph325H4s z;3v}Bw}FWs;LLuYmGr<7fRV;e1Gh*Au22qrXUYIVpl$-ikajkZ-_}*Ya^l>40oZAC zbI4(k4)LA93KpD<)E5(*8!kL-{+N1=f)E zYrsCz+HJsf($3vL195I11YRaxdki>9T73?9fVhQx4j4zE!o5I@w01H;wNW=8xQ_t4 z)&ddI^P7N!Ht<#8wyp02iwIQcrQ)P(j|1mOLl=Na1RnPnFoie+qXC0-R}lD-G_(kq zK>0hK158_US(=Ux{hc%w0s8g=Pm|VtMo&Vzs~;F7jb8#DA@Ir}U?zdCRRS-P9;l_} zNDnUoYKYUj0eH#Q&A@Teo38_Y%J2LT*g(4Z3t&HK-6`Nt(%j15X+;Ds+yH2s=o|~s zGox=7U_WQ=GGGpYsw2Qt6xZBhHYYN%#Kwf_oKtEl8claN=XBQ8B8GF!mOQQ>RkwX5XXjV(`n8loT#77m`W_hp?pfWNgLYS5`$InmRf45FQ@UMku9pBJ4uw!lc=eb-sX-) z02+t4kuX(5>|EphMRl!BHO%5x2&HQ-foK`kU4{#5ZYhabgKzqCn%eGwTXaKJqH*4a zUBo$4cr>nv;(VplPph8LS`1ZeUgJF`GD=d*x^GAm@fRE>**ma*Y7`xf8%y{(SwyxS z&b>`a$K6*V67Q8r#ZMGX8rHtjF)8^gqP$Er;Vy|rSCUCR%BSJ)zdDj9r2WLgQaKA@Jg$&@@MI@o(TC^d)p;>!#>z!di{6d zT7|PdR^I=ZcWnJ^S-85WGV41%MizU=SIPdU?2&YTk#!Hn4iNOknAbE1m~K zcVN$HVAJF7w;RMP(-c z`<*9nw}+*{JeP+?2-L-@??q2mQ%8`kdGy!2F0ZlqQ&E@Q^NMVOO+L6vdTw92C77%y zP!zUs{yGt6b^C*?D(V*(Z2D`{q_L&9$hdtqEMM*9!;)xqFAcI23w{yxtU!ilXc;9z zP20bbyX|2MxF=-g%Yv-^T&cKV`RXAK3OSoUvG|m@V6BO;2(@}xEnD`MXe7k`{(KrQ z6Jq%?(R|2i-5O-&Q=bvJtb3{0Pl)v-C6%>yb%`*Vgi0J4DK1!Gq->8xYQB`7?q!wI z$m_B=^SnDKCulmlo&Q#8`q4EkJgP@{oy{$sAvPCchgM9I)Ig?Q8u|Bj7a8AP_WlPG Cp~C|J delta 2404 zcmZ{me{54#6vw};9V>I88&0-W3}w(zMwGR*ZcKs`iI^prP2(>nY_HuLd)U2KUR&mn zSioplf--z6C?-Tg9D)$$B`N{Q0xA<0shA)bMM5AXn5 zd(S!d-K3*g$7t5ke`jGh90-TBAy?(5`f2G*0nmREI71vd1!Rd`XMr2U(I0>!2XOu( zP^R-TaEbi&r;+<*3V{+`jRPtPf87R5BWA_}wZxrez+B>*a$pMOdw&5Il08%bJWA~M zAdMv?_T2?MOU!tI9^&v+U>)({>A)*Q*G%ATV&gr)d&KntV34>o1RNrk)&s|gmG=SE z1N`%VbHw!z06*zm09+@oq0^mXh)tA3+_ESQOeQhZ4Acbq zgRa8??a<+>bX#Y#O-cxfs3gJA9nvx>nb&bul1-gZR71uRNui@7w}NDc7~`ZOi>4(d zMb*^ZLfn+H*prjpVz&^BEm5MT6^+JwE!}0L(xPa$k*Z63fq5!7RR8f%}Q6oY^)Vf-$i}mhlNg}CgYn>BYqk^#& z+0lG8x{Mix=`vrKF7t(vGz-&Z%BY;AxFVHnjUFZTzMNW(8}#_Ad|)heN@-x^O`ARQcHDgHA`0<=E|G11CocOb5Gh z@oUovvMYt0(KN|6wBkV@J62b2ZWLq_VqaQ$+OAd~TbTa+X2-yrwu5JdB28cvtldBs|+%% z_YgbcFDuGlcSt+Fw1)lj(EV06JHAxnjOSV`Blk|~HdyZ@q&4mLv*SCetQG9Fk7qc| zomtaJz>X~cv9HjI6kk8*@ci$C3~4nXdPjH6byVE?#fI2-v*tJ}0>N9i=c$@upIZ}J zVH;NlxJdP)Ub|M0m>p}CSG`*Qto8p$vuoM>jdQGFvF$Bm%$%^+5Sh-TrVq{c5oQgM HFADwxYKE-x diff --git a/libft/includes/libft.h b/libft/libft.h similarity index 100% rename from libft/includes/libft.h rename to libft/libft.h diff --git a/main.c b/main.c index 3f7361e..ff8cd8d 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */ -/* Updated: 2019/06/01 19:44:31 by hulamy ### ########.fr */ +/* Updated: 2019/06/03 14:24:08 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */